Sha256: d619b0b8b0f9e8443d10af0be0e64c3e3a632ca797cda0f3b86ebeb764af164c
Contents?: true
Size: 794 Bytes
Versions: 10
Compression:
Stored size: 794 Bytes
Contents
# 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 dispatch :facts do param 'Target', :target return_type 'Hash[String, Data]' end def facts(target) unless Puppet[:tasks] raise Puppet::ParseErrorWithIssue.from_issue_and_stack( Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'facts' ) end inventory = Puppet.lookup(:bolt_inventory) { nil } unless inventory raise Puppet::ParseErrorWithIssue.from_issue_and_stack( Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('get facts for a target') ) end inventory.facts(target) end end
Version data entries
10 entries across 10 versions & 1 rubygems