What is the best way to declare an attribute in attributes/default.rb which is really expected to be defined at a higher level, say an environment or even a wrapper cookbook? I am reluctant to give it a default value, since it is too easy to forget to change it when a cookbook gets deployed. In the past we have used entries like “invalid” if it is a string, or an illegal number based on the context.
Should I just go all the way and use ‘nil’? As well as adding an explicit check in the recipe to look for the undefined value and log a descriptive message?
What is the best way to declare an attribute in attributes/default.rb
which is really expected to be defined at a higher level, say an
environment or even a wrapper cookbook? I am reluctant to give it a
default value, since it is too easy to forget to change it when a cookbook
gets deployed. In the past we have used entries like “invalid” if it is a
string, or an illegal number based on the context.
Should I just go all the way and use ‘nil’? As well as adding an explicit
check in the recipe to look for the undefined value and log a descriptive
message?
--
Stephen Corbesero, DevOps Engineer
Synchronoss - Mobile Innovation for a Connected World
Yes, you can do that, and also combine it with an attribute validator
if you are concerned about making sure people set something somewhere
(and that the values are valid).
What is the best way to declare an attribute in attributes/default.rb
which is really expected to be defined at a higher level, say an environment
or even a wrapper cookbook? I am reluctant to give it a default value,
since it is too easy to forget to change it when a cookbook gets deployed.
In the past we have used entries like “invalid” if it is a string, or an
illegal number based on the context.
Should I just go all the way and use ‘nil’? As well as adding an explicit
check in the recipe to look for the undefined value and log a descriptive
message?
--
Stephen Corbesero, DevOps Engineer
Synchronoss - Mobile Innovation for a Connected World