error while resolving custom facts in /opt/puppetlabs/puppet/cache/lib/facter/env_oracle.rb: cannot load such file -- xmlsimple

asked 2018-04-26 04:48:13 -0600

shajics gravatar image

Iam getting below error, while trying to display a custom fact

2018-04-26 09:35:44.470342 ERROR puppetlabs.facter - error while resolving custom facts in /opt/puppetlabs/puppet/cache/lib/facter/env_oracle.rb: cannot load such file -- xmlsimple

Here is the complete stuff that iam trying to do: --

[root@cdalab facter]# puppet config print factpath /opt/puppetlabs/puppet/cache/lib/facter:/opt/puppetlabs/puppet/cache/facts [root@cdalab facter]# [root@cdalab facter]# [root@cdalab facter]# cd /opt/puppetlabs/puppet/cache/lib/facter [root@cdalab facter]# [root@cdalab facter]# ls -ltr total 4 -rw-r--r--. 1 root root 1357 Apr 26 09:31 env_oracle.rb [root@cdalab facter]# cat env_oracle.rb

!/usr/local/bin/ruby begin ## Required GEMs require 'facter' require 'xmlsimple' require 'time'

This is the hash that will contain the facts o_inventory = {}

## Function for sourcing the bash_profile from the server def Source(filename) fail(ArgumentError,"File #{filename} invalid or doesn't exist.") \ unless File.exist?(filename)

_newhashstr=env -i sh -c 'set -a;source #{filename} && ruby -e "p ENV"' fail(ArgumentError,"Failure to parse or process #{filename} environment")\ unless _newhashstr.match(/^{("[^"]+"=>".?",\s)("[^"]+"=>".?")}$/)

_newhash=eval(_newhashstr) %w[ SHLVL PWD _ ].each{|k|_newhash.delete(k) }
_newhash.each{|k,v| ENV[k]=v } # ENV does not have #merge! end

Source "/home/oracle/.bash_profile"

o_inventory['ORACLE_BASE']#{ENV['ORACLE_BASE']} o_inventory['ORACLE_HOME']=#{ENV['ORACLE_HOME']} o_inventory['AGENT_HOME']#{ENV['AGENT_HOME']} o_inventory['GRID_HOME']#{ENV['GRID_HOME']}

Add the Inventory elements to Facter

o_inventory.each do |name, fact|
Facter.add(name) do setcode do fact end
end end end

[root@cdalab facter]# facter -p ORACLE 2018-04-26 09:44:25.126591 ERROR puppetlabs.facter - error while resolving custom facts in /opt/puppetlabs/puppet/cache/lib/facter/env_oracle.rb: cannot load such file -- xmlsimple

[root@cdalab facter]#

Any help would be really appreciated

edit retag flag offensive close merge delete