We set the version like this in php::default :
version = node[:php][:version] node.set['php']['version'] = version # this way nodes won’t upgrade when default attribute changes include_recipe "php::#{version}” include_recipe 'php::configuration' include_recipe 'php::monitoring' if node.roles.include? 'monitoring'
Then we split up recipes per version (this php cookbook would have a 5.3, 5.4 and 5.5 recipe) and common stuff we put in common recipes (like configuration). If there’s special upgrade logic it would get called in the corresponding version recipe. Certain errors with certain upgrade caveats get raised in default recipe (before all the includes).
We use this technique quite often, as we have to be very conservative with major software upgrades.
Hope this helps. Let us know how you handled it.
Kr, Steven On 09 Dec 2013, at 23:14, Cerny,Nathan <
">
> wrote:
I am wanting to use normal attributes to track version changes of installed software across chef-client runs. This would give us the ability to trigger special logic on a downgrade/upgrade/rerun scenario.
For instance, if we install php 5.3, then change the attribute to php 5.5, I want the recipe to either trigger special upgrade logic or error as the situation requires.
Has anyone gone down this path before? Are there snags or gotchya's I should watch out for? Is it a completely insane path?
Thanks!
Nathan Cerny
System Architect, Operations Infrastructure
- Population Health Dev
CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
|