[chef] Re: Re: can we force a "node save" in a "why run" mode


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: can we force a "node save" in a "why run" mode
  • Date: Thu, 17 Sep 2015 14:46:17 -0700



On Thursday, September 17, 2015 at 2:42 PM, Ranjib Dey wrote:

> theres nothing stopping you from invoking a node.save. Add a handler that 
> hooks at run_finished and then inside it check if its why run mode and 
> invoke node.save.
> but as brian said, this is a very very bad idea,
> whole point of why run is to not change anything ...just to estimate what 
> will be updated


Node#save itself will try to stop you: 
https://github.com/chef/chef/blob/a59b1992cabd063bdcf1494a1a3d0edf48ffa0d5/lib/chef/node.rb#L546-L560
Though you could do a begin/ensure around temporarily unsetting why_run. 

Anyway, we can probably give you better options if you tell us what problem 
you are trying to solve.

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§