I have a recipe that starts a service that can be configured by environment variables. Looking at how to set the variables (adding a bash script to /etc/profile.d
didn't do the trick), I came across How to set environment variable using Chef? and so configured a rb file set the variables:
vars.rb:
ENV["foo"] = "bar"
myrecipe.rb:
require "/path/to/vars.rb"
service "someservice" do
action :restart
end
When I run this, I get the following:
WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method
Is this the best way to set variables for the service? Are the warnings acceptable? How can I get this to run cleanly?
Chef is version 12.04.