[chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: remote_file resource -- new to Chef


Chronological Thread 
  • From: Bryan Berry < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Re: Re: remote_file resource -- new to Chef
  • Date: Mon, 13 Feb 2012 22:16:08 +0100

for quick and dirty, use a ruby_block

ruby_block "move wars" do
   block do
     require 'fileutils'
     # this is pseudo-code
     app_war = File('/tmp/app.war')
     dest_war = File('/tmp/dest.war')
     app_checksum = Sha256sum(app_war)   
     dest_checksum = Sha256sum(dest_war)    
     if app_checksum != dest_checksum
        FileUtils.cp_f app_war, dest_war
     end
   end
end

though remote_file should really support a file path rather than just a URL, I recommend filing a bug on tickets.opscode.com

On Mon, Feb 13, 2012 at 9:59 PM, mark bradley < "> > wrote:
Yes, from Jenkins to this server, into /tmp


On Mon, Feb 13, 2012 at 3:58 PM, Bryan Berry < " target="_blank"> > wrote:
then u use ssh to copy over the file?


On Mon, Feb 13, 2012 at 9:56 PM, mark bradley < " target="_blank"> > wrote:
Yes, there is a URL but it's blocked off my a firewall unfortunately.


On Mon, Feb 13, 2012 at 3:50 PM, Bryan Berry < " target="_blank"> > wrote:
does the jenkins server make the .war available from a url?
do you have a maven repository to the war goes into after it is built?


On Mon, Feb 13, 2012 at 9:48 PM, mark bradley < " target="_blank"> > wrote:
It's a Jenkins server but it's behind a firewall and this server has to stay outside it for the (undefined duration) moment :( 

We're using Jenkins and Maven here. I'd be glad to help if I can!

Mark


On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry < " target="_blank"> > wrote:
why don't u use the url from the ci server? what is your ci server? artifactory?

umm, do you use maven? I was thinking of writing a maven lwrp to fetch wars like this much like the deploy resources works

We use jenkins + artifactory at my office. I am looking for a collaborator on this topic as I know ruby + chef fairly well but not much about the java deployment chain. I will write the maven lwrp either way but having some feedback from someone who actually understands these systems will make it more effective :)


On Mon, Feb 13, 2012 at 9:42 PM, mark bradley < " target="_blank"> > wrote:
The war file is copied into /tmp from a CI server at the moment.

Thanks for the pointer! It'll come in useful.

Mark


On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry < " target="_blank"> > wrote:
from what I can tell remote_file only supports pulling from a url or the files/ subdirectory of your cookbook.  Where do you get app.war from in the first place?

btw, if you are working on a java stack these java-related cookbooks may be useful to you  https://github.com/bryanwb/cookbooks/tree/master/java 



On Mon, Feb 13, 2012 at 9:03 PM, mark bradley < " target="_blank"> > wrote:
Hi, I'm trying to copy a file on change (both files are in /tmp for now):

default["FOO"]["latest_war"] = "/tmp/app.war"
default["FOO"]["target_war"] = "/tmp/dest.war"

My resource specification looks like this:

remote_file node.default["FOO"]["target_war"] do
  action :create
  source node.default["FOO"]["latest_war"]
end


When I run the Chef client I get an error:

[Mon, 13 Feb 2012 19:55:09 +0000] FATAL: Chef::Exceptions::FileNotFound: remote_file[/tmp/dest.war] (XX line 65) had an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not contain a file at any of these locations:
  files/amazon-2011.09//tmp/app.war
  files/amazon//tmp/app.war
  files/default//tmp/app.war

Is there a way of forcing remote_file to look outside the cookbook? Have I misunderstood this resource? Is there a better one to use?

Thanks,
Mark












Archive powered by MHonArc 2.6.16.

§