[chef] RE: Re: Puzzled about convergence, please advise?


Chronological Thread 
  • From: "Fouts, Chris" < >
  • To: " " < >
  • Subject: [chef] RE: Re: Puzzled about convergence, please advise?
  • Date: Thu, 13 Nov 2014 21:16:05 +0000
  • Accept-language: en-US

Sorry, I should’ve shown this example to explain why I “need” a template.

 

rpm_package “Installing RPM” do

  action :install

  package_name myRPM.rpm

end       

 

template “/opt/some_path/conf/myRPMconfig.xml” do

  source “myRPMconfig.xml.erb”

  variable({

      “var1” => node.mycookbook.var1

  })

end

 

From: Ranjib Dey [mailto:
Sent: Thursday, November 13, 2014 3:46 PM
To:
Subject: [chef] Re: Puzzled about convergence, please advise?

 

resources are executed at converge time, but they are built (resource collection) during compilation time. to build the template resource u need to read the template file, inject variables and finally in converge tim check if that differs from the existing one and replace it. so the resource building part itself requires the file to be present. 

you dont need template here, you want remote file with file:/// as source, can you try that?

hope this help

ranjib

 

On Thu, Nov 13, 2014 at 12:21 PM, Fouts, Chris < " target="_blank"> > wrote:

I thought I understood this, so I’m puzzled that it’s not working the way I think it should work. I have the following simple recipe.

 

rpm_package “Installing RPM” do

  action :install

  package_name myRPM.rpm

end       

 

template “/opt/some_path/conf/myRPMconfig.xml” do

  source “myRPMconfig.xml.erb”

end

 

I expect both resources to be executed during convergence (run time), correct?

 

If so, the rpm_package should install myRPM.rpm, which creates the /opt/some_path/conf directory, so when the template resource runs, the directory is already there. However, when I run chef-client, I get an error saying “No such file or directory  - /opt/some_path/conf”

 

I know that myRPM.rpm creates the directory because if I install it manually, it does create it.

 

Any advise?

 

Chris

 




Archive powered by MHonArc 2.6.16.

§