I can override default attributes in my recipes\roles but I am unable to get any other attributes that are dependant on that attribute to also update.
as an example, for the phantomjs cookbook I want to install 1.9.7 rather than the default 1.9.2. (I know this change has now been committed to the cookbook repo)
I can override the version with:
node.set['phantomjs']['version'] = "1.9.7"
but in the phantomjs default attributes there is a dependant attribute that uses this with string substitution to generate the base url for the download:
default['phantomjs']['basename'] = "phantomjs-#{node['phantomjs']['version']}-linux-#{node['kernel']['machine']}"
Is there a way to set the version attribute so that the change is performed before these dependant attributes are evaluated? Or a way to force a re-evaluation?
This has been a problem I have hit before and in the past I just override everything that is dependant .. but this is not a great approach going forward.
I am using the latest chef (just tested with 11.8.2 under vagrant but latest chef 11.10.4 elsewhere) and using both chef-solo and the chef server.
Thanks.
You need to move your own cookbook (that override this attribute) upper in run list. String interpolation (foo-"#{whatever}"
) executed in compile time (while loading attribute files) and chef-client loads them in order of run list.
Or you have an option to override all dependent attributes manually, but this is road to hell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With