bolt-modules/boltlib/lib/puppet/functions/facts.rb in bolt-0.20.6 vs bolt-modules/boltlib/lib/puppet/functions/facts.rb in bolt-0.20.7
- old
+ new
@@ -1,12 +1,15 @@
# frozen_string_literal: true
require 'bolt/error'
# Returns the facts hash for a target.
-# This functions takes one parameter, the target to get facts for
Puppet::Functions.create_function(:facts) do
+ # @param target A target.
+ # @return The target's facts.
+ # @example Getting facts
+ # facts($target)
dispatch :facts do
param 'Target', :target
return_type 'Hash[String, Data]'
end
@@ -22,9 +25,12 @@
unless inventory
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('get facts for a target')
)
end
+
+ executor = Puppet.lookup(:bolt_executor) { nil }
+ executor&.report_function_call('facts')
inventory.facts(target)
end
end