Skip to content

Commit a15f2b1

Browse files
Merge pull request #8522 from ciprianbadescu/PUP-10940/puppet-facts-diff-env
(PUP-10940) puppet facts diff facter-ng reload
2 parents f722a15 + c4cd83a commit a15f2b1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/puppet/face/facts.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@
133133

134134
if Puppet::Util::Package.versioncmp(Facter.value('facterversion'), '4.0.0') < 0
135135
facter3_result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname])
136-
begin
137-
require 'facter-ng'
138-
facter4_result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname])
139-
rescue LoadError
140-
raise ArgumentError, 'facter-ng could not be loaded'
136+
137+
# puppet/ruby are in PATH since it was updated in the wrapper script
138+
puppet_cmd = 'puppet facts show --facterng --render-as json'
139+
if Puppet::Util::Platform.windows?
140+
puppet_cmd = "ruby -S -- puppet facts show --render-as json"
141141
end
142-
fact_diff = FactDif.new(facter3_result.to_json, facter4_result.to_json, EXCLUDE_LIST)
142+
facter4_result = Puppet::Util::Execution.execute(puppet_cmd)
143+
144+
fact_diff = FactDif.new(facter3_result.to_json, facter4_result, EXCLUDE_LIST)
143145
fact_diff.difs
144146
else
145147
Puppet.warning _("Already using Facter 4. To use `puppet facts diff` remove facterng from the .conf file or run `puppet config set facterng false`.")

0 commit comments

Comments
 (0)