bolt-modules/boltlib/lib/puppet/functions/run_plan.rb
# Wrap any Sensitive parameters in the Sensitive wrapper type, unless they are already
# wrapped as Sensitive. This will also raise a helpful warning if the type expression
# is a complex data type using Sensitive, as we don't handle those cases.
Wrap any Sensitive parameters in the Sensitive wrapper type, unless they are already
wrapped as Sensitive. This will also raise a helpful warning if the type expression
is a complex data type using Sensitive, as we don't handle those cases.
Wrap any Sensitive parameters in the Sensitive wrapper type unless they are already wrapped as Sensitive . This will also raise a helpful warning if the type expression is a complex data type using Sensitive as we don ' t handle those cases .
def wrap_sensitive_parameters(params, param_models)
    models = param_models.each_with_object({}) { |param, acc| acc[param.name] = param }
    params.each_with_object({}) do |(name, value), acc|
      model = models[name]
      if model.nil?
        acc[name] = value
      elsif sensitive_type?(model.type_expr)
        acc[name] = Puppet::Pops::Types::PSensitiveType::Sensitive.new(value)
      else
        if model.type_expr.to_s.include?('Sensitive')
          file = defined?(model.file) ? model.file : :default
          line = defined?(model.line) ? model.line : :default
          Puppet.warn_once(
            'unsupported_sensitive_type',
            name,
            "Parameter '#{name}' is a complex type using Sensitive, unable to automatically wrap as Sensitive",
            file,
            line
          )
        end
        acc[name] = value
      end
    end
  end
def wrap_sensitive_parameters ( params , param_models ) models = param_models . each_with_object ( { } ) { | param , acc | acc [ param . name ] = param } params . each_with_object ( { } ) do | ( name , value ) , acc | model = models [ name ] if model . nil? acc [ name ] = value elsif sensitive_type? ( model . type_expr ) acc [ name ] = Puppet :: Pops :: Types :: PSensitiveType :: Sensitive . new ( value ) else if model . type_expr . to_s . include? ( 'Sensitive' ) file = defined? ( model . file ) ? model . file : :default line = defined? ( model . line ) ? model . line : :default Puppet . warn_once ( 'unsupported_sensitive_type' , name , "Parameter '#{name}' is a complex type using Sensitive, unable to automatically wrap as Sensitive" , file , line ) end acc [ name ] = value end end end
Wrap any Sensitive parameters in the Sensitive wrapper type, unless they are already
wrapped as Sensitive.
Wrap any Sensitive parameters in the Sensitive wrapper type unless they are already wrapped as Sensitive .
# Parameters passed to a plan that the plan is not expecting don't have a model, # so keep the parameter as-is. # Include the location for regular plans. YAML plans don't have this info, so # the location will be suppressed.
params
<not_specific>
param_models
<not_specific>