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

Issue #93 #94

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions libraries/chef_nexus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ def encrypted_data_bag_for(node, data_bag)

def encrypted_data_bag_item(node, data_bag, data_bag_item)
if node[:nexus][:use_chef_vault]
item = ChefVault::Item.load(data_bag, data_bag_item)
begin
item = ChefVault::Item.load(data_bag, data_bag_item)
# if you are using vault and if data bag it not present we need to handle that exception as well
rescue ChefVault::Exceptions::KeysNotFound
return nil
end
else
item = Chef::EncryptedDataBagItem.load(data_bag, data_bag_item)
end
Expand All @@ -226,10 +231,6 @@ def encrypted_data_bag_item(node, data_bag, data_bag_item)
# Adding a different rescue block if things exception needs to be handled differently
rescue Chef::Exceptions::ValidationFailed => e
nil

# if you are using vault and if data bag it not present we need to handle that exception as well
rescue ChefVault::Exceptions::KeysNotFound
nil
end
end
end
Expand Down