New to Chef, bare wi/ me. Building my cookbook.
ERROR new to chef
82 Views Asked by RayMontez At
2
There are 2 best solutions below
2
On
Glad you have your data bag loading and indeed, with Test Kitchen you do not need to use knife to upload to Chef Server, as Test Kitchen uses Chef Zero / Solo.
The issue you have here is that you have not correctly formatted reading from the data bag object once you have read. You need to do this instead:
ruby_block "insert_line" do
block do
file = Chef::Util::FileEdit.new('/var/lib/net-snmp/snmpd.conf')
file.insert_line_if_no_match("/www.example.com/", "createUser
#{snmp3usercreds['user']}
SHA #{snmp3usercreds['auth_pssword']}
AES #{snmp3usercreds['enc_password']} ")
file.write_file
end
end
So, you will see I have changed snmp3usercreds[user] to snmp3usercreds['user'] with quotes around the user to show it is a string (rather than a variable as is the case with your code).
How did you set the databag?
are you able to get the credential out using :
or