matschaffer / knife-solo

DEPRECATED: Please consider using https://knife-zero.github.io/, ansible, or visit https://www.chef.io/ for other ideas
MIT License
787 stars 213 forks source link

knife bootstrap fails with an rsync error #489

Open percov opened 8 years ago

percov commented 8 years ago

knife solo bootstrap user@hostname -i .chef/key.pem runs successfully for me. Inside of knife.rb, I've specified knife[:solo] = true to make knife ec2 bootstrap with knife solo. When I run the following command knife bootstrap user@hostname -i .chef/key.pem I get the following error:

percent_expand: unknown key %C rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0] ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--rsh=ssh user@hostname -i .chef/key.pem -o ControlMaster=auto -o ControlPath=/var/lib/user/.chef/knife-solo-sockets/%C -o ControlPersist=3600", "--delete-after", "-zt", "--exclude=revision-deploys", "--exclude=.git", "--exclude=.hg", "--exclude=.svn", "--exclude=.bzr", "/var/lib/user/.chefdk/gem/ruby/2.1.0/gems/knife-solo-0.6.0/lib/knife-solo/resources/patch_cookbooks/", ":~/chef-solo/cookbooks-1"]

Both my host and client are using Ubuntu Server 14.04 LTS. Do you know what I am doing wrong?

matschaffer commented 8 years ago

The percent_expand: unknown key %C is likely the issue. You'll need a new-ish openssh client to support that.

For now I'd recommend running with --ssh-control-master no or knife[:ssh_control_master] = 'no' in your knife.rb.

matschaffer commented 8 years ago

Oh, just noticed you're calling bootstrap, so use the knife.rb setting.

percov commented 8 years ago

Following your suggestion, I added the line of text to my knife.rb. knife solo bootstrap works fine however knife bootstrap keeps complaining about rsync. I've isolated the cause of the error with knife bootstrap to not being able to read the contents of the config with a line of code (215) in knife-solo/lib/knife-solo/ssh_command.rb. I edited the code to print out the value for config[:ssh_control_master].When I run knife solo bootstrap it displays the expected value of no, however when I run knife bootstrap it gives me nil. I also tried iterating all the values of the config to see if the file was formatted correctly and I got these two different outputs. Do you know why this is occurring?

matschaffer commented 8 years ago

Hm. Could be the setting doesn't get applied when going via bootstrap. Have you tried the latest release of knife-solo? The default in the newest version is "no" anyway.

percov commented 8 years ago

I'm using version 0.6.0. I did notice that the default setting for ssh_control_master was no when I looked through it.

vagifzeynalov commented 7 years ago

I'm having the same problem too. And I'm using 0.6.0 version too.

% chef gem list knife --local
*** LOCAL GEMS ***
...
knife-solo (0.6.0)

Perhaps you can change the base path for it at https://github.com/matschaffer/knife-solo/blob/5e9f6528709d63f1d9eba69d54d6bc76658df2cd/lib/knife-solo/ssh_command.rb#L221 dir = File.join(ENV['HOME'], '.chef', 'knife-solo-sockets') to something like /tmp/... Or at least make it configurable?

Thank you!

P.S. Quick & dirty fix like dir = File.join('/tmp/.chef', 'knife-solo-sockets') resolved the problem