[chef] Re: Re: Re: Re: cookbok file-- copy only if new


Chronological Thread 
  • From: Jordan Dea-Mattson < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: cookbok file-- copy only if new
  • Date: Thu, 12 Sep 2013 13:47:19 -0700

Excellent point Benjamin! And one that I missed making and only thought about after my initial post (and hadn't gotten around to posting a follow-up).

I think we need to consider a refactor that combines `cookbook_file`, 'file' and `remote_file` into a single resource. We can maintain the three aliases for background compatibility.

Jordan




On Thu, Sep 12, 2013 at 1:32 PM, Benjamin Bytheway < " target="_blank"> > wrote:
Also, remote_file has been upgraded to allow conditional GETs.  So if the files are being hosted on something that supports if-modified-since, then you can just use a standard action :create and it will only update the file if the remote file has been updated.

They you wouldn't necessarily have to modify the checksum in the cookbook each time you update the file.

use_last_modified Indicates that If-Modified-Since headers are enabled. Set to false to disable If-Modified-Since headers. To use this setting, use_conditional_get must also be set to true. Default value: true.



On Thu, Sep 12, 2013 at 2:23 PM, Jordan Dea-Mattson < " target="_blank"> > wrote:
Hi Manoj -

If I am understanding what you are trying to do, I don't believe that using :create_if_missing will work for you (which is consistent with what you suspect).

My understanding is that you want to do the following:

+ Create a .war file that has the same name for every version of the file.
+ Only copy the file when there is a new version
++ But that new version will have the same name

Is that correct?

If so, I believe that using `remote_file` is your best option. It will allow you to specify a checksum and will only copy the file if the checksum matches what you specify.

Alternatively, you could use cookbook_file, but use a conditional that requires they checksum you calculate is different from what is deployed.




On Thu, Sep 12, 2013 at 1:00 PM, Alan Ivey < " target="_blank"> > wrote:
The :create_if_missing action will only put the file in place if it doesn't already exist.

The .war file can be in the cookbook/files/default/file_name.war. Then, use the action:

cookbook_file "/destination/path/to/file_name.war" do
  action :create_if_missing"
end




--
Alan Ivey


On Thu, Sep 12, 2013 at 2:29 PM, Manoj Thakkar < " target="_blank"> > wrote:
Hi,

This is what i am trying to do, i build my war file and copy it in the chef cookbook files/default folder and then run chef-client on my deployment node assuming it will copy the new file.

My recipe says cookbook file "file_name" ...... , I ma not sure what should i write it in the action statement
As the war file name will always be the same so create or create if missing does not make sense,

Please help.










Archive powered by MHonArc 2.6.16.

§