[chef-dev] Re: Resource requirements for an Idempotent resource


Chronological Thread 
  • From: Kishore S Kumar < >
  • To: Daniel DeLeo < >
  • Cc: chef-dev < >
  • Subject: [chef-dev] Re: Resource requirements for an Idempotent resource
  • Date: Tue, 11 Dec 2012 06:11:19 +0530

its here https://gist.github.com/4254683  -  I had a recipe to install a package X on a node which already had that package, and also in my recipe I provided a source which did not exist. The recipe failed saying that the requirements were not met, however I wouldn't want to fail because the running the action would cause no change as package is already installed (idenpotency)


On Mon, Dec 10, 2012 at 11:08 PM, Daniel DeLeo < " target="_blank"> > wrote:

On Sunday, December 9, 2012 at 10:25 PM, Kishore S Kumar wrote:

Hi,

I'm trying to understand how resource requirements work with idempotent resource. Can someone help me. Currently I have a idempotent resource which say install a software unless it is already installed. I have resource requirement assertion set for the action which fail if the installer does not exist.
What should have happened  when I try to run the recipe on a node where the software is already installed(idempotency) and the installer does not exist(resource requirements failed). 

right now the recipe fails saying the resource requirements failure.

Thanks
Kishore
Full explanation of what resource requirements are and do here: https://github.com/opscode/chef/blob/master/lib/chef/mixin/why_run.rb#L63-123

Short version is that they are for implementing why-run's precondition detection and assumption behavior. The canonical example is the case where you have a service that's not installed yet. Since chef can't query the init script to see if the service is running, it can't give any realistic information about whether a service would be started, so it emits a warning and then proceeds assuming the action would have been run.

-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§