hw-cookbooks / lxc

Linux Containers via Chef
58 stars 49 forks source link

Using the available chef package for bootstrapping a container returns an exception #55

Open therobot opened 10 years ago

therobot commented 10 years ago

I'm getting the following exception when trying to create a container with lxc cookbook. I'm using Ubuntu 14.04 and the 2.0 version of the lxc cookbook.

  * execute[lxc copy_chef_full[mycontainer]] action run
================================================================================
Error executing action `run` on resource 'execute[lxc copy_chef_full[mycontainer]]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of cp ["/opt/chef_11.12.8-2_amd64.deb"] /var/lib/lxc/mycontainer/rootfs/opt ----
STDOUT:
STDERR: cp: cannot stat '[/opt/chef_11.12.8-2_amd64.deb]': No such file or directory
---- End output of cp ["/opt/chef_11.12.8-2_amd64.deb"] /var/lib/lxc/mycontainer/rootfs/opt ----
Ran cp ["/opt/chef_11.12.8-2_amd64.deb"] /var/lib/lxc/mycontainer/rootfs/opt returned 1

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/lxc/libraries/monkey.rb:20:in `monkey_shell_out!'

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/lxc/providers/container.rb

148:     execute "lxc copy_chef_full[#{new_resource.name}]" do
149:       command "cp #{file_path} #{_lxc.rootfs.join('opt')}"
150:       not_if do
151:         file_path.nil? || !new_resource.chef_enabled || _lxc.rootfs.join(file_path).exist?
152:       end
153:     end
154:

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/lxc/providers/container.rb:148:in `block in class_from_file'

execute("lxc copy_chef_full[mycontainer]") do
  action "run"
  retries 0
  retry_delay 2
  guard_interpreter :default
  command "cp [\"/opt/chef_11.12.8-2_amd64.deb\"] /var/lib/lxc/mycontainer/rootfs/opt"
  backup 5
  returns 0
  cookbook_name "dnsimple-lxc"
  not_if { #code block }
end

After I remove /opt/chef_11.12.8-2_amd64.deb from its location the exception disappears and chef completes successfully.