Le 2014-12-11 18:12, Douglas Garstang a écrit :
For thoose edge cases, you may use include_attributes to reload the attribute file you know need it.
But as far as you tell it, just do a node['tomcat']['java_options'] += " -Xms#{jvm_heap_min}M -Xmx#{jvm_heap_max}M -Djava.awt.headless=true" in your recipe should do...
If you really have to use node.override (which I highly doubt a simple node['attr'] should do) or wish to set in the recipe the value and then reload the atrtibute file the idea would be to do something like:
in the attribute file:
[..sliced..]
default['tomcat']['java_options'] += " -Dcom.sun.management.jmxremote.ssl=false"
default['tomcat']['java_options'] += node['slice-tomcat']['java_tier_options'] if node.include?('slice-tomcat') && node['slice-tomcat'].include?('java_tier_option')
the if is evaluated left to right, if the first is false, it will stop there and not raise a no method exception for [] on nil class on the second one
then in your recipe
node['slice-tomcat']['java_tier_options'] += " -Xms#{jvm_heap_min}M -Xmx#{jvm_heap_max}M -Djava.awt.headless=true"
include_attribute 'slice-tomcat'
But generally if you have to set attributes in the recipe, you're doing something the wrong way somewhere.
You may have a better time namescoping by instance type,then you may copy the correct namespaced attributes into the target one instead of conditionnaly adding parameters. (you'll still do something like node['tomcat']['java_options'] = node['intance_type']['java-options'] at the end, but it sounds less hard to maintain in time)
I'm perhaps not really clear, feel free to tell and I'll try to write something more structured :)
|
Archive powered by MHonArc 2.6.16.