fnichol / chef-homesick

Chef library cookbook to manage Homesick castle repositories.
http://fnichol.github.io/chef-homesick
28 stars 15 forks source link

'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' ---- STDOUT: error. Could not pull dotfiles, expected /home/mdesales/.homesick/repos/dotfiles/home exist and contain dotfiles #4

Open marcellodesales opened 10 years ago

marcellodesales commented 10 years ago

Hi @fnichol,

I've been trying to build a Vagrant box with chef-homesick and I'm getting a problem during bootstrap... It is clear to me that it is doing a successful "clone", but also is doing an "update" as well and fails to do the "pull"... I'm guessing the sequence is incorrect...

My environment is: mdesales@Marcello-Work ~/dev/workboxes/cfp-workbox (master) $ ruby --version ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.5.0] homesick-0.9.7 * Chef 10.30.2 * Vagrant 1.4.1 Ubuntu 13.04

Here's the log of the error

uccessfully installed homesick-0.9.7 1 gem installed Installing ri documentation for homesick-0.9.7... rdoc --ri --op /var/lib/gems/1.9.1/doc/homesick-0.9.7/ri lib ChangeLog.markdown LICENSE README.markdown --title homesick-0.9.7 Documentation --quiet Installing RDoc documentation for homesick-0.9.7... rdoc --op /var/lib/gems/1.9.1/doc/homesick-0.9.7/rdoc lib ChangeLog.markdown LICENSE README.markdown --title homesick-0.9.7 Documentation --quiet Reading package lists... Building dependency tree... Reading state information... vim is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. [default] Running provisioner: chef_solo... Generating chef JSON and uploading... Running chef-solo... stdin: is not a tty stdin: is not a tty [2013-12-25T22:39:52+00:00] INFO: * Chef 10.30.2 * [2013-12-25T22:39:52+00:00] INFO: Setting the run_list to ["recipe[apache2]", "recipe[homesick]", "recipe[zsh]", "recipe[oh-my-zsh]", "recipe[users::ruby_shadow]", "recipe[users::sysadmins]", "recipe[users::sysadmin_sudo]", "recipe[homesick_agent::data_bag]", "recipe[root_ssh_agent::ppid]", "recipe[ssh_known_hosts]"] from JSON

2013-12-25T22:39:55+00:00] INFO: execute[ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick clone git://github.com/marcellodesales/dotpickles.git --force'] ran successfully

Error executing action run on resource 'execute[ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force']'

Mixlib::ShellOut::ShellCommandFailed

Expected process to exit with [0], but received '1' ---- Begin output of ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' ---- STDOUT: error Could not pull dotfiles, expected /home/mdesales/.homesick/repos/dotfiles/home exist and contain dotfiles STDERR: Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. ---- End output of ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' ---- Ran ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' returned 1

Resource Declaration:

In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/homesick_agent/libraries/castle_agent.rb

39: execute remote_command 40: end

Compiled Resource:

Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/homesick_agent/libraries/castle_agent.rb:39:in `run_with_agent'

execute("ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force'") do action "run" retries 0 retry_delay 2 command "ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force'" backup 5 returns 0 cookbook_name :homesick end

[2013-12-25T22:39:55+00:00] ERROR: Running exception handlers [2013-12-25T22:39:55+00:00] ERROR: Exception handlers complete [2013-12-25T22:39:55+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out [2013-12-25T22:39:55+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: execute[ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force'](/tmp/vagrant-chef-1/chef-solo-1/cookbooks/homesick_agent/libraries/castle_agent.rb line 39) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' ---- STDOUT: error Could not pull dotfiles, expected /home/mdesales/.homesick/repos/dotfiles/home exist and contain dotfiles STDERR: Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. ---- End output of ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' ---- Ran ssh -A -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no mdesales@localhost 'PATH=$PATH:/opt/vagrant_ruby/bin homesick pull dotfiles --force' returned 1 Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.

CADBOT commented 10 years ago

@marcellodesales I just a had an issue like this my recipe as well. I was doing something like this: homesick_castle 'main_castle' do
user 'CAD' source 'git://github.com/CADBOT/dotfiles.git' action :install end

To make a long story short I figured out your castle name has to be the same as your dotfiles project name on github. This fixed it homesick_castle 'dotfiles' do
user 'CAD' source 'git://github.com/CADBOT/dotfiles.git' action :install end

I'm not sure if this is the desired or if it's simply a bug, but the castle name must match the name of the github repo. I might look into it in the next few days and submit a patch to the author.

marcellodesales commented 10 years ago

Sounds good... I will try to continue with this again and see if it works!

Thanks a lot!

thomasmeeus commented 10 years ago

I'm having the same issue when using the data_bag recipe. Chef won't continue until I manually create /home/$user/.homesick/repos/dotfiles/home for every user.

My data_bag:

{
  "id"        : "thomas",
  "comment"   : "Thomas",
  "home"      : "/home/thomas",
  "groups"    : ["admin"],
  "password"  : "$..mKGWkU1",
  "ssh_keys"  : ["ssh-rsa AAAAB..e"],
  "homesick_castles"  : [
    { "name"    : "dotfiles",
      "source"  : "git@github.com:thomasmeeus/dotfiles.git"
    }
  ]
}

The error:

114 Recipe: homesick::default
114   * chef_gem[homesick] action install (up to date)
114 Recipe: homesick::data_bag
114   * homesick_castle[dotfiles] action install
114 
114 Recipe: <Dynamically Defined Resource>
114   * execute[homesick clone git@github.com:thomasmeeus/dotfiles.git --force] action run
114     - execute homesick clone git@github.com:thomasmeeus/dotfiles.git --force
114 
114   * execute[homesick pull dotfiles --force] action run
114 ================================================================================
114 Error executing action `run` on resource 'execute[homesick pull dotfiles --force]'
114 ================================================================================
114 
114 
114 Mixlib::ShellOut::ShellCommandFailed
114 ------------------------------------
114 Expected process to exit with [0], but received '1'
114 ---- Begin output of homesick pull dotfiles --force ----
114 STDOUT: error  Could not pull dotfiles, expected /home/thomas/.homesick/repos/dotfiles/home exist and contain dotfiles
114 STDERR: 
114 ---- End output of homesick pull dotfiles --force ----
114 Ran homesick pull dotfiles --force returned 1
114 
114 
114 Resource Declaration:
114 ---------------------
114 # In /var/chef/cache/cookbooks/homesick/providers/castle.rb
114 
114  71:   execute command do
114  72:     user          new_resource.user
114  73:     environment   env
114  74:   end
114  75: end
114 
114 
114 
114 Compiled Resource:
114 ------------------
114 # Declared in /var/chef/cache/cookbooks/homesick/providers/castle.rb:71:in `run'
114 
114 execute("homesick pull dotfiles --force") do
114   action "run"
114   retries 0
114   retry_delay 2
114   guard_interpreter :default
114   command "homesick pull dotfiles --force"
114   backup 5
114   environment {"USER"=>"thomas", "HOME"=>"/home/thomas"}
114   returns 0
114   user "thomas"
114   cookbook_name "homesick"
114 end
114 
114 
114 
114 
114 Running handlers:
114 [2014-07-11T10:07:15+02:00] ERROR: Running exception handlers
114 Running handlers complete
114 
114 [2014-07-11T10:07:15+02:00] ERROR: Exception handlers complete
114 [2014-07-11T10:07:15+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
114 Chef Client failed. 7 resources updated in 36.584150207 seconds
114 [2014-07-11T10:07:15+02:00] ERROR: execute[homesick pull dotfiles --force] (/var/chef/cache/cookbooks/homesick/providers/castle.rb line 71) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
114 ---- Begin output of homesick pull dotfiles --force ----
114 STDOUT: error  Could not pull dotfiles, expected /home/thomas/.homesick/repos/dotfiles/home exist and contain dotfiles
114 STDERR: 
114 ---- End output of homesick pull dotfiles --force ----
114 Ran homesick pull dotfiles --force returned 1
114 [2014-07-11T10:07:15+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)