chef-boneyard / chef-vault

chef-vault cookbook
https://supermarket.chef.io/cookbooks/chef-vault
Apache License 2.0
60 stars 53 forks source link

Undefined method 'unpack' for nil:NilClass #68

Closed mccw closed 6 years ago

mccw commented 6 years ago

Cookbook version

3.1.0

Chef-client version

13.8.5

Platform Details

Server 2016

Scenario:

trying to install certs on server 2016

Steps to Reproduce:

the step is failing at cookbook compilation

Expected Result:

installed sertificates

Actual Result:

10.21.0.229 Installing Cookbook Gems: 10.21.0.229 [2018-04-30T09:41:21-05:00] INFO: Fetching gem metadata from https://www.rubygems.org/............. 10.21.0.229 Fetching version metadata from https://www.rubygems.org/.. 10.21.0.229 Resolving dependencies... 10.21.0.229 Using bundler 1.15.4 10.21.0.229 Using chef-vault 3.3.0 10.21.0.229 Bundle complete! 1 Gemfile dependency, 2 gems now installed. 10.21.0.229 Use bundle info [gemname] to see where a bundled gem is installed. 10.21.0.229 10.21.0.229 [2018-04-30T09:41:21-05:00] INFO: Fetching gem metadata from https://www.rubygems.org/............. 10.21.0.229 Fetching version metadata from https://www.rubygems.org/.. 10.21.0.229 Resolving dependencies... 10.21.0.229 Using bundler 1.15.4 10.21.0.229 Using chef-vault 3.3.0 10.21.0.229 Bundle complete! 1 Gemfile dependency, 2 gems now installed. 10.21.0.229 Use bundle info [gemname] to see where a bundled gem is installed. 10.21.0.229 10.21.0.229 Compiling Cookbooks... 10.21.0.229 10.21.0.229 10.21.0.229 10.21.0.229 ================================================================================ 10.21.0.229 Recipe Compile Error in c:/chef/cache/cookbooks/recipes/certs.rb 10.21.0.229 ================================================================================ 10.21.0.229 10.21.0.229 NoMethodError 10.21.0.229 ------------- 10.21.0.229 undefined method unpack' for nil:NilClass 10.21.0.229 10.21.0.229 Cookbook Trace: 10.21.0.229 --------------- 10.21.0.229 c:/chef/cache/cookbooks/chef-vault/libraries/helpers.rb:39:inchef_vault_item' 10.21.0.229 c:/chef/cache/cookbooks/recipes/certs.rb:3:in `from_file' 10.21.0.229 10.21.0.229 Relevant File Content: 10.21.0.229 ---------------------- 10.21.0.229 c:/chef/cache/cookbooks/chef-vault/libraries/helpers.rb: 10.21.0.229 10.21.0.229 32: # @example 10.21.0.229 33: # item = chef_vault_item('secrets', 'bacon') 10.21.0.229 34: # log 'Yeah buddy!' if item['_default']['type'] 10.21.0.229 35: # @param [String] bag Name of the data bag to load from. 10.21.0.229 36: # @param [String] id Identifier of the data bag item to load. 10.21.0.229 37: def chef_vault_item(bag, id) 10.21.0.229 38: if ChefVault::Item.vault?(bag, id) 10.21.0.229 39>> ChefVault::Item.load(bag, id) 10.21.0.229 40: elsif node['chef-vault']['databag_fallback'] 10.21.0.229 41: data_bag_item(bag, id) 10.21.0.229 42: else 10.21.0.229 43: raise "Trying to load a regular data bag item #{id} from #{bag}, and databag_fallback is disabled" 10.21.0.229 44: end 10.21.0.229 45: end 10.21.0.229 46: 10.21.0.229 47: # Helper method which provides an environment wrapper for a data bag. 10.21.0.229 48: # This allows for easy access to current environment secrets inside 10.21.0.229 10.21.0.229 System Info: 10.21.0.229 ------------ 10.21.0.229 chef_version=13.8.5 10.21.0.229 platform=windows 10.21.0.229 platform_version=10.0.14393 10.21.0.229 ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32] 10.21.0.229 program_name=C:/opscode/chef/bin/chef-client 10.21.0.229 executable=C:/opscode/chef/bin/chef-client

thommay commented 6 years ago

Was this previously working? what does your recipe code look like?

mccw commented 6 years ago

I just tested this in development and it looks like it's working. So this might be due to the fact that the server in question was deleted this morning and re-created, so it's probably client/vault related.

mccw commented 6 years ago

Yes, it does look like it had something to do with vault permissions. I'm closing this as a non-issue. thank you for the quick response!