Method: Bolt::Shell#unwrap_sensitive_args
- Defined in:
- lib/bolt/shell.rb
#unwrap_sensitive_args(arguments) ⇒ Object
Unwraps any Sensitive data in an arguments Hash, so the plain-text is passed to the Task/Script.
This works on deeply nested data structures composed of Hashes, Arrays, and and plain-old data types (int, string, etc).
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/bolt/shell.rb', line 80 def unwrap_sensitive_args(arguments) # Skip this if Puppet isn't loaded return arguments unless defined?(Puppet::Pops::Types::PSensitiveType::Sensitive) case arguments when Array # iterate over the array, unwrapping all elements arguments.map { |x| unwrap_sensitive_args(x) } when Hash # iterate over the arguments hash and unwrap all keys and values arguments.each_with_object({}) { |(k, v), h| h[unwrap_sensitive_args(k)] = unwrap_sensitive_args(v) } when Puppet::Pops::Types::PSensitiveType::Sensitive # this value is Sensitive, unwrap it unwrap_sensitive_args(arguments.unwrap) else # unknown data type, just return it arguments end end |