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

chef_vault_item_or_default method not working with kitchen mocked secret #24

Open
RvRivi opened this issue Nov 29, 2019 · 0 comments
Open

Comments

@RvRivi
Copy link

RvRivi commented Nov 29, 2019

For a secret defined in kitchen.yml like the following

- name: default
  run_list:
  - recipe[XXX]
  attributes:
    chef_secrets:
      fake:
        secret:
          user: password

the following code is raising an exception during the second if evaluation (if secret_with_default['user'] != 'password') whereas chef_vault_item_or_default() is expecting have the same behaviour than chef_vault_item() in that case

secret_with_default = chef_vault_item_or_default('fake', 'secret', 'default')
secret = chef_vault_item('fake', 'secret')

if secret['user'] != 'password'
  Chef::Log.info 'secret != password'
  raise
end

if secret_with_default['user'] != 'password'
  Chef::Log.info 'secret_with_default != password'
  raise
end

Please note this issue is only triggered in a kitchen test environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant