matschaffer / knife-solo

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

Path to ssh identity file not escaped when passed to chef/rsync #525

Closed Fitzsimmons closed 6 years ago

Fitzsimmons commented 6 years ago

Try running knife solo cook with a -i parameter that has characters in it that need shell escaping.

For example:

knife solo cook -i "$HOME/Projects - Current/private_key.pem" user@example.com. Even though the path gets passed properly into the invocation of knife solo cook, it does not get escaped when knife solo then passes it to rsync:


Uploading the kitchen...
Warning: Identity file /home/user/Projects not accessible: No such file or directory.
bash: - : invalid option
Usage:  bash [GNU long option] [option] ...
    bash [GNU long option] [option] script-file ...
GNU long options:
    --debug
    --debugger
    --dump-po-strings
    --dump-strings
    --help
    --init-file
    --login
    --noediting
    --noprofile
    --norc
    --posix
    --protected
    --rcfile
    --rpm-requires
    --restricted
    --verbose
    --version
Shell options:
    -irsD or -c command or -O shopt_option      (invocation only)
    -abefhkmnptuvxBCHP or -o option
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]
ERROR: RuntimeError: Failed to launch command ["rsync", "-rL", "--rsh=ssh user@example.com -i /home/user/Projects - Current/private_key.pem"```
matschaffer commented 6 years ago

I've pushed 0.7.0.pre3 for this fix incase you have a need for it today.