[chef] 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: Need to copy a file after installation to another place
  • Date: Wed, 04 Sep 2013 13:57:56 -0600

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.


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

On Wednesday, September 4, 2013 at 11:11 AM, Russell Bateman wrote:

Thanks for responding. I'm unclear on this. I'm copying a file from one place on the client node to another place on the client node. Which of these two places is "remote"?

Not sure exactly what you're commenting on, so…

Yeah, it's a little odd that it's called "remote_file" and now it copies files from a filesystem on a box to a filesystem on the same box. We recently rewrote the internals so the thing that used to be exclusively focused on fetching an HTTP resource and copying it to disk now internally has a few backends, which allows it to support ftp and file URLs. In the long term we could consider renaming it or adding an alias if the current situation impedes grok-ability

As for actually using it, you want to do

remote_file("/path/to/destination") do
  # other stuff
end

-- 
Daniel DeLeo
 

On 9/4/2013 12:08 PM, Daniel DeLeo wrote:

On Wednesday, September 4, 2013 at 11:06 AM, Russell Bateman wrote:

I'm creating a node in a MongoDB replica set that furnishes a) an arbiter, b) a configsvr and c) a sharding router. Unfortunately, as the binary that implements the arbiter and the configsvr are one and the same (mongod) and it cannot be multiply loaded, the customary action is to make a copy of it. This sort of thing is only done on testing instances (not in production).

So, one recipe installs MongoDB via the Debian package. mongod is on the path /usr/bin/mongod and I want to make a copy of it on the path /data/mongodb/bin/mongd. My configsvr.rb recipe ends with this:

# Copy /usr/bin/mongod to /data/mongodb/bin/mongod because a separate copy
# must exist in order for the configuration server's mongod instance not
# to conflict with the arbiter's instance. This copy will be referenced by
# /etc/init/mongodb-configsvr.conf.
file "/data/mongodb/bin/mongod" do
  action :create
  owner "mongodb"
  group "mongodb"
  mode 00755
  content IO.read( "/usr/bin/mongod" )
end

Sadly, this only creates a zero-length file.

I'm guessing this will be a Chef anti-pattern and I do want to hear the cat-calls, but I'd also like a solution.

Profuse thanks for reading this.

Best,

Russ
In Chef 11.6 you can use a `file:///` URL for a remote file to copy it from a local source.

-- 
Daniel DeLeo







Archive powered by MHonArc 2.6.16.

§