Navigation Menu

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 does not work in test kitchen. #13084

Open
ecottom opened this issue Jul 15, 2022 · 1 comment
Open

chef_vault_item does not work in test kitchen. #13084

ecottom opened this issue Jul 15, 2022 · 1 comment
Assignees
Labels
Status: Good First Issue An issue ready for a new contributor. Type: Bug Does not work as expected.

Comments

@ecottom
Copy link

ecottom commented Jul 15, 2022

Internal issue https://chefio.atlassian.net/browse/CHEF-1254

Description

When chef_vault_item was moved into chef client in #9369 the node attributes chef-vault and databag_fallback were never set. Any call to chef_vault_item in test kitchen will result in undefined method '[]' for nil:NilClass for node["chef-vault"]["databag_fallback"].

Chef Version

Chef client 16.x-17.x

Platform Version

  • All

tested on:

  • rhel8
  • win2019

Replication Case

recipe

value = chef_vault_item('test', 'test')['key']
log "key has value: #{value}"

test data_bag

{
  "id": "test",
  "key": "value"
}

Workaround

Adding the following to the kitchen.yml suite fixes this issue:

  attributes:
     # workaround for chef_vault_item in test kitchen
    chef-vault:
      databag_fallback: true

Client Output

       ================================================================================
       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/vault_testing/recipes/default.rb
       ================================================================================
       
       NoMethodError
       -------------
       undefined method `[]' for nil:NilClass
       
       Cookbook Trace: (most recent call first)
       /tmp/kitchen/cache/cookbooks/vault_testing/recipes/default.rb:

         1:  #
         2:  # Cookbook:: vault_testing
         3:  # Recipe:: default
         4:  #
         5:  # 
         6:
         7>> value = chef_vault_item('test', 'test')['key']
         8:  log "key has value: #{value}"
         9:

       System Info:
       ------------
       chef_version=17.10.3
       platform=redhat
       platform_version=8.6
       ruby=ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client
@ecottom ecottom added the Status: Untriaged An issue that has yet to be triaged. label Jul 15, 2022
@PrajaktaPurohit PrajaktaPurohit added Type: Bug Does not work as expected. Status: Good First Issue An issue ready for a new contributor. and removed Status: Untriaged An issue that has yet to be triaged. labels Jul 19, 2022
@tpowell-progress tpowell-progress self-assigned this Aug 18, 2023
@tpowell-progress
Copy link
Contributor

Seeing that @clintoncwolfe is assigned to the internal issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Good First Issue An issue ready for a new contributor. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

3 participants