Problems with Fact returning the version of an installed RPM.
125 views
Skip to first unread message
Richie Rees
unread,
Nov 15, 2013, 6:31:13 AM11/15/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Hi,
Have written what I think is a simple fact to return the version of an installed RPM, but when I use the returned variable its blank so perhaps someone can point me in the write direction, or somone might know a better way to do this. Here is the fact :-
require 'facter'
Facter.add('rpmbversion') do
setcode do
Facter::Util::Resolution.exec("rpm -qia rpm_name | grep Version | sed 's/Version : //g' |cut -f1-5 -d' '")
end
end
Thanks in Advance :)
Richie.
Dan White
unread,
Nov 15, 2013, 7:46:13 AM11/15/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes)
From: "Richie Rees" <richard...@gmail.com> To: puppet...@googlegroups.com Sent: Friday, November 15, 2013 6:31:13 AM Subject: [Puppet Users] Problems with Fact returning the version of an installed RPM.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Thanks Ygor, gold stars for you and pints of beer, unfortunately this still doesn't return the version to the fact. Do i have to pass the resulting string to a variable and then pass the variable back ?
Dan White
unread,
Nov 15, 2013, 9:24:04 AM11/15/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
OK. Time for a possibly silly question:
How are you getting the name of the RPM into the Ruby code ?
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes)
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Hi Richie,
Using the iptables_version fact thats part of the puppetlabs firewall module, you can tweak that to change the command to return the rpm version as in Dan's example.
The below code will return the full version string for the sqlite rpm
Jacob
Facter.add(:sqlite_version) do
confine :kernel => :linux
setcode do
version = Facter::Util::Resolution.exec('rpm -q --qf \'%{version}-%{release}-%{arch}\' sqlite')