Hi All,

I setup a custom fact to display the list of packages. It displays nicely 
with a facter command, but does not show up 
right in the foreman gui. Any suggestion how to fix the view?

# facter -p packages

[root@ip-172-31-7-124 ~]# facter  -p packages
tfm-rubygem-passenger-native-libs 4.0.18-9.11.el7
gnutls 3.3.8-14.el7_2
filesystem 3.2-20.el7
ntpdate 4.2.6p5-22.el7.centos.2
net-tools 2.0-0.17.20131004git.el7
libndp 1.2-4.el7
tzdata 2016a-1.el7
libtiff 4.0.3-14.el7
xz-libs 5.1.2-12alpha.el7
jansson 2.4-6.el7
libsepol 2.1.9-3.el7
cloud-init 0.7.5-10.el7.centos.1
info 5.1-4.el7
popt 1.13-16.el7
kernel 3.10.0-327.10.1.el7
nss-util 3.19.1-4.el7_1
tuned 2.5.1-4.el7_2.2
gawk 4.0.2-4.el7
chrony 2.1.1-1.el7.centos
sqlite 3.7.17-8.el7
parted 3.1-23.el7
libffi 3.0.13-16.el7
selinux-policy-targeted 3.13.1-60.el7_2.3
libattr 2.4.46-12.el7
passwd 0.79-4.el7
libnl3 3.2.21-10.el7
tar 1.26-29.el7
lua 5.1.4-14.el7
puppetlabs-release-pc1 1.1.0-2.el7
libcap-ng 0.7.5-4.el7
gpg-pubkey 7dfe6fc2-57cd589f
findutils 4.5.11-5.el7
ruby-libs 2.0.0.598-25.el7_1
file 5.11-31.el7
rubygem-bigdecimal 1.2.0-25.el7_1
nss-softokn 3.16.2.3-13.el7_1
rubygems 2.0.14-25.el7_1
libgomp 4.8.5-4.el7
rubygem-multi_json 1.10.1-3.el7
libedit 3.0-12.20121213cvs.el7
rubygem-kafo_parsers 0.1.2-1.el7
slang 2.2.4-11.el7
foreman-selinux 1.13.0-1.el7
libdaemon 0.14-7.el7
centos-release-scl 2-2.el7.centos
ethtool 3.15-2.el7
rh-ruby22-runtime 2.0-6.sc1.el7
dmidecode 2.12-9.el7
rh-ruby22-rubygem-psych 2.0.8-12.el7
less 458-9.el7
rh-ruby22-rubygems 2.4.5-12.el7
vim-minimal 7.4.160-1.el7
sclo-ror42-rubygem-rack 1.6.2-2.el7
tcp_wrappers 7.6-77.el7
tfm-rubygem-net-ldap 0.15.0-1.el7
mozjs17 17.0.0-12.el7
sclo-ror42-rubygem-i18n 0.7.0-3.el7
kmod-libs 20-5.el7
sclo-ror42-rubygem-tzinfo 1.2.2-2.el7
krb5-libs 1.13.2-10.el7
tfm-rubygem-ruby2ruby 2.1.3-4.el7
python-libs 2.7.5-34.el7
tfm-rubygem-little-plugger 1.1.3-21.el7
cracklib 2.9.0-11.el7
tfm-rubygem-http-cookie 1.0.2-1.el7
dbus-python 1.1.1-9.el7
....

foreman gui: (attached png)


Here is the script I used to generate the fact

(using the code 
from http://www.uberobert.com/puppet-facts-with-package-versions/)

# cat lib/facter/packages.rb 
version = Facter::Util::Resolution.exec("rpm -qa --queryformat '[%{NAME} 
%{VERSION}-%{RELEASE}\n]'")

Facter.add(:packages) do
  setcode do
    packages = {}
      
    version.each_line do |package|
      package_name = "#{package.split[0]}".gsub('-','_')
      package_version = "#{package.split[1]}"
      packages[package_name] = package_version
    end
  end
end

Any suggestion on a fix is really appreciated!

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to