We have a Chef environment setup. Our deployments work fine, with node attributes properly overridden by roles and environments.
In order to test an upcoming change, we want to change a setting on 1 particular node in our deployment. We don't want to write a different recipe, role or environment for that test as there is really only 1 setting different.
I tried via Chef Manage's web UI and set the particular node's attribute as follows:
{
"tags": null,
"our_app":{
"url": "http://test-server"
}
}
In our cookbook the attributes/default.rb
is set as follows:
default[:our_app][:url] = ''
In our environment file, we override the setting as follows:
override_attributes({
"our_app" => {
"url" => "http://default-server",
}
})
We use the following .erb
template inside our recipe:
{
"serverUrl": "<%= node[:our_app][:url]%>"
}
However, when we run chef-client on that node, it still ends up with http://default-server
in the output.
I understand the attribute precedence as explained in the docs . But I am not sure how to achieve what I want.
Am I supposed to not use override_attributes()
in my environment file?
Is there a way to have a node-specific override attribute ?