Skip to content

Commit

Permalink
Merge pull request #54 from bastelfreak/foo
Browse files Browse the repository at this point in the history
update fact_on() from `facter` to `puppet facts`
  • Loading branch information
bastelfreak authored Dec 11, 2024
2 parents b137621 + 6156e1c commit b43d6be
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/beaker_puppet_helpers/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,7 @@ def apply_manifest(manifest, opts = {}, &block)
def fact_on(host, name, opts = {})
raise(ArgumentError, "fact_on's `name` option must be a String. You provided a #{name.class}: '#{name}'") unless name.is_a?(String)

if opts.is_a?(Hash)
opts['json'] = nil
else
opts << ' --json'
end

result = on host, Beaker::Command.new('facter', [name], opts)
result = on host, Beaker::Command.new('puppet facts show', [name], opts)
if result.is_a?(Array)
result.map { |res| JSON.parse(res.stdout)[name] }
else
Expand Down

0 comments on commit b43d6be

Please sign in to comment.