Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Sep 27, 2014
1 parent db8a20f commit 84bac2a
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit 84bac2a

Please sign in to comment.