Hello!
I’m trying to figure out how to do an audit using a reference to a node attribute that is an array and have the audit iterate through the array.
For example, my audit file would contain something like this:
default[‘cookbook’][‘packages’] = [ “sssd”, “sshd”, “nc”, “tcpdump”, “httpd” ]
Then, in my audit, I want to do something to the effect of:
it 'Verify required packages' do
expect(package("#{node['cookbook']['packages'].each}")).to be_installed
end
Of course, this is not the correct way to do it or else I wouldn’t be asking the question. But hopefully, it makes clear what I’m trying to do.
Is there a way to do this?
Thanks!!