Method: Puppet::Parameter#format

Defined in:
lib/puppet/parameter.rb

#format(fmt, *args) ⇒ String

Note:

Because the default implementation of Puppet::Property#is_to_s returns the current value as-is, it doesn’t necessarily return a string. For the sake of sanity we just cast everything to a string for interpolation so we don’t introduce issues with unexpected property values.

Formats the given string and conditionally redacts the provided interpolation variables, depending on if this property is sensitive.

Parameters:

  • fmt (String)

    The format string to interpolate.

  • args (Array<String>)

    One or more strings to conditionally redact and interpolate into the format string.

Returns:

  • (String)

See Also:

  • String#format


564
565
566
# File 'lib/puppet/parameter.rb', line 564

def format(fmt, *args)
  fmt % args.map { |arg| @sensitive ? "[redacted]" : arg.to_s }
end