-
Notifications
You must be signed in to change notification settings - Fork 40
ERROR: machine_batch[default] (@recipe_files::/root/workdir/kafka-cluster.rb line 64) had an error: Errno::ENOENT: No such file or directory @ rb_sysopen - proc/10110/root/etc/chef/client.pem #66
Comments
This won't work. First, chef-provisioning is not designed to run under docker. |
Thanks marc-, Does chef provide a library to do the http transfer - if so what is it, or would it be necessary to write it from scratch ? |
No, it doesn't. You can probably start from looking at |
Here is a first "stupid" (not using HTTP) implementation using netcat on the destination: def write_file(path, content)
server = Socket.new(:INET, :STREAM, 0)
ip = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}
ip = ip.ip_address if ip
server.bind(Addrinfo.tcp(ip, 0))
port = server.local_address.ip_port
server.close
server = TCPServer.new(port)
Thread.new do
client = server.accept
client.print content
client.flush
client.close
end
execute "mkdir -p #{File.dirname path}"
res = 1
while res != 0
res = execute("sh -c 'nc -v -q1 #{ip} #{port} > #{path} 2>/tmp/nc_error'").exitstatus
end
Chef::Log.debug("write_file server.close")
server.close
end def upload_file(local_path, path)
write_file(path, File.read(local_path))
end |
LGTM. You need to replace nc with ruby code and make a PR. |
I opened PR #67 |
Hi, I'm having this error when trying to run chef-provisioning-docker from within docker (which is actually quite useful to get a reproducible self-contained chef environment and allows to run multiple chef-provisioning on different drivers in parallel ).
I don't know the cause of this behaviour, all that I know is that write_file method in
/lib/chef/provisioning/docker_driver/docker_transport.rb
determins the pem path from
container_path()
method, which in turn, does:My quick and dirty bypass is to force the containing directory creation:
I'm guessing that the fact that I'm in a container changes the way the driver behaves, what do you think ?
If you think this bypass is acceptable, I can submit a PR.
The text was updated successfully, but these errors were encountered: