Using chef_vault_item
in a recipe and testing via ChefSpec returns the following error:
Chef::Exceptions::InvalidDataBagPath:
Data bag path '/var/folders/5d/46p9wf6976l9xptq3fwsrj9r0000gp/T/d20210228-64571-1lao3dr/data_bags' not found. Please create this directory.
Stub data bag
and data bag item
. See files below for full example.
before do
allow(Chef::DataBag)
.to receive(:load).with('secrets').and_return('passwords' => {})
allow(Chef::DataBagItem)
.to receive(:load).with('secrets', 'passwords').and_return(secret_data)
stub_data_bag_item('secrets', 'passwords').and_return(secret_data)
end
let(:secret_data) do
{
'id' => 'passwords',
'db_pass' => 'secretdbpass'
}
end