Sha256: 39188f242b48297824e9d81ab96ce874587d990011433ef02bf60398781cc47d
Contents?: true
Size: 885 Bytes
Versions: 2
Compression:
Stored size: 885 Bytes
Contents
# frozen_string_literal: true require 'bolt/error' # Returns a hash of the 'vars' (variables) assigned to a target. # # Vars can be assigned through the inventory file or `set_var` function. # Plan authors can call this function on a target to get the variable hash # for that target. Puppet::Functions.create_function(:vars) do # @param target The Target object to get variables from. See {get_targets}. # @return A hash of the 'vars' (variables) assigned to a target. # @example Get vars for a target # $target.vars dispatch :vars do param 'Target', :target return_type 'Hash[String, Data]' end def vars(target) inventory = Puppet.lookup(:bolt_inventory) # Bolt executor not expected when invoked from apply block executor = Puppet.lookup(:bolt_executor) { nil } executor&.report_function_call('vars') inventory.vars(target) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bolt-1.21.0 | bolt-modules/boltlib/lib/puppet/functions/vars.rb |
bolt-1.20.0 | bolt-modules/boltlib/lib/puppet/functions/vars.rb |