[chef] Re: Re: Re: Re: Re: Re: Need to copy a file after installation to another place


Chronological Thread 
  • From: Russell Bateman < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Need to copy a file after installation to another place
  • Date: Thu, 05 Sep 2013 09:43:30 -0600

While I'm not convinced that this is impossible in "normal" Chef recipe code, I stumbled upon the idea of just using a script to do it. (I am, after all, new to and still very perplexed by Chef.) Here's what I did to get around my inability to make the "remote file to remote file" copy work:
# Create a script on the fly to copy the mongod daemon for our configuration
# server to run off of. (The latter cannot share /usr/bin/mongod because the
# arbiter is going to be using that one.)
bash "copy-mongod" do
  user "root"
  cwd "/data/mongodb"
  code <<-EOS
  cp /usr/bin/mongod ./bin
  chown mongodb:mongodb ./bin/mongod
  chmod a+x ./bin/mongod
  EOS
end

Thanks for bearing with me on this!

Russ

On 9/4/2013 3:22 PM, Russell Bateman wrote:
" type="cite"> No, on the client I'm using 11.4.4-2. My chef server is running 10.18.1.

Incidentally, I also tried a ruby_block using FileUtils.cp() which didn't work either.
file "/data/mongodb/bin/mongodb" do
    action :create
    owner "mongodb"
    group "mongodb"
    mode 00644
end

require 'fileutils'

ruby_block "copy-mongod-binary"
    block do
        FileUtils.copy( "/usr/bin/mongod", "/data/mongodb/bin/mongod", { :preserve => false } )
    end
end




On 9/4/2013 3:04 PM, Daniel DeLeo wrote:
" type="cite">

On Wednesday, September 4, 2013 at 12:57 PM, Russell Bateman wrote:

Adopting that, ...
remote_file( "/data/mongodb/bin/mongod" )
  source "file:///usr/bin/mongod"
  owner "mongodb"
  group "mongodb"
  mode 00755
end

I get:
Errno::ECONNREFUSED
----------------------------------
Connection refused - Connection refused connecting to : for /usr/bin/mongod/file:///usr/bin/mongod, giving up

I'm playing around trying to trick it not prefix it with redundant path, but to no avail so far.

Thanks.
Are you using Chef 11.6.0?


-- 
Daniel DeLeo





Archive powered by MHonArc 2.6.16.

§