Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sensitive values in to_json_pretty #1418

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Feb 19, 2024

  1. Support sensitive values in to_json_pretty

    The idea is being able to do something like this, (where just the call
    to `to_json_pretty` is explicitly `Deferred` - needed because
    `node_encrypt` returns a `Deferred`)
    
    ```puppet
    file { '/etc/my_secret.json':
      content => Deferred('to_json_pretty',[{
        username => 'myuser',
        password => lookup('my_eyaml_secret').node_encrypt::secret,
      }]),
    }
    ```
    
    ... instead of having to also explicitly defer `unwrap` and `Sensitive` and
    end up with a huge mess similar to...
    
    ```puppet
    file { '/etc/my_secret.json':
      content => Sensitive(
        Deferred('to_json_pretty',[{
          username => 'myuser',
          password => Deferred('unwrap', [lookup('my_eyaml_secret').node_encrypt::secret]),
        }])
      ),
    }
    ```
    
    The thought behind `rewrap_sensitive_data` is it makes it easy to
    extend this functionality into other similar functions, (`to_yaml`,
    `to_toml` etc.)
    
    Later, we might consider adding a `deferrable_to_XXX` functions to
    further simplify this sort of use-case.
    alexjfisher committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    e7fa675 View commit details
    Browse the repository at this point in the history