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

Document use of databags_fallback for chef-vault in kitchen #64

Open
tquid opened this issue Dec 1, 2017 · 3 comments
Open

Document use of databags_fallback for chef-vault in kitchen #64

tquid opened this issue Dec 1, 2017 · 3 comments

Comments

@tquid
Copy link

tquid commented Dec 1, 2017

The databags_fallback flag appears to be undocumented. I have an example excerpt of .kitchen.yml in issue 59 that should serve the purpose.

@tquid
Copy link
Author

tquid commented Dec 5, 2017

Ported here for convenience:

suites:
  - name: default
    run_list:
      - recipe[foo::bar]
      ...
    data_bags_path: 'test/integration/data_bags' # This is relative to the directory with .kitchen.yml
    attributes:
      chef-vault:
        databags_fallback: true

@thommay
Copy link
Contributor

thommay commented Dec 6, 2017

thanks @tquid

@jakereps
Copy link

I'm having some issues trying to use this feature of chef-vault. I've set it up as suggested in this, and other threads, and it seems to be failing with a 404 regardless of my databag failover setting. I've attached some output to help with any debugging that may be required:

suites:
  - name: default
    verifier:
      inspec_tests:
        - test/integration/default
    run_list:
        - recipe[...]
    data_bags_path: 'test/integration/data_bags'
    attributes:
        ...
        chef-vault:
            databag_fallback: true
       Net::HTTPServerException
       ------------------------
       404 "Not Found"

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/chef-vault/libraries/helpers.rb:37:in `chef_vault_item'
         /tmp/kitchen/cache/cookbooks/x/recipes/configuration.rb:??:in `block in from_file'
         /tmp/kitchen/cache/cookbooks/x/recipes/configuration.rb:??:in `from_file'
         /tmp/kitchen/cache/cookbooks/x/recipes/default.rb:??:in `from_file'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/chef-vault/libraries/helpers.rb:

        30:    # +node['chef-vault']['databag_fallback']+.
        31:    # @example
        32:    # item = chef_vault_item('secrets', 'bacon')
        33:    # log 'Yeah buddy!' if item['_default']['type']
        34:    # @param [String] bag Name of the data bag to load from.
        35:    # @param [String] id Identifier of the data bag item to load.
        36:    def chef_vault_item(bag, id)
        37>>     if ChefVault::Item.vault?(bag, id)
        38:        ChefVault::Item.load(bag, id)
        39:      elsif node['chef-vault']['databag_fallback']
        40:        data_bag_item(bag, id)
        41:      else
        42:        raise "Trying to load a regular data bag item #{id} from #{bag}, and databag_fallback is disabled"
        43:      end
        44:    end
        45:
        46:    # Helper method that allows for listing the ids of a vault in a recipe.

       System Info:
       ------------
       chef_version=14.15.6
       platform=centos
       platform_version=7.8.2003
       ruby=ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-linux]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client

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

No branches or pull requests

3 participants