salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-cloud ssh/scp fail on Mac OS

Open jasonrm opened this issue 12 years ago • 14 comments

After grasping at straws all day for why I couldn't provision VMs on EC2 and DigitalOcean I finally gave up and decided to just use local VMs. And then ran into, what I think is, the same issue.

Anyhow, I've 'fixed' my issue for the moment as you'll see by the end, but perhaps this might help someone figure out the root cause.

Versions

Salt Master

$ uname -a
Darwin jasonrm-mbp.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

$ git rev-parse HEAD
9d31fc810f1a412825aa38f9c392ef4ae3f6fa66

$ salt --versions-report
           Salt: 2014.1.0-3321-g9d31fc8
         Python: 2.7.6 (default, Feb 15 2014, 21:24:43)
         Jinja2: 2.7.2
       M2Crypto: 0.22
 msgpack-python: 0.4.1
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
         PyYAML: 3.10
          PyZMQ: 14.1.0
            ZMQ: 4.0.4

VM - Ubuntu 12.04.04

$ sudo ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] uname -a
Warning: Permanently added '10.10.0.127' (RSA) to the list of known hosts.
Linux ubuntu 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:42:40 UTC 2014 i686 i686 i386 GNU/Linux

VM - Arch Linux

$ sudo ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] uname -a
Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
Linux arch 3.13.6-1-ARCH #1 SMP PREEMPT Fri Mar 7 22:30:23 CET 2014 i686 GNU/Linux

Config Files

cloud

minion:
    master: 10.10.0.104

cloud.maps.d/jasonrm-local.conf

vm-arch:
    - jasonrm.arch1:
        ssh_username: root
        ssh_host: 10.10.0.128
        minion:
            pidfile: /var/run/salt/salt-minion.pid

vm-ubuntu:
    - jasonrm.ubuntu1:
        ssh_username: root
        ssh_host: 10.10.0.127

cloud.profiles.d/jasonrm-saltify.conf

vm-arch:
    provider: jasonrm-saltify
    key_filename: /Users/jason/git-local/salt-dev/keys/jasonrm-saltify
    minion:
        master: 10.10.0.104

vm-ubuntu:
    provider: jasonrm-saltify
    key_filename: /Users/jason/git-local/salt-dev/keys/jasonrm-saltify
    minion:
        master: 10.10.0.104

cloud.providers.d/jasonrm-saltify.conf

jasonrm-saltify:
    provider: saltify

Output

Init

$ sudo salt-cloud -c . -m cloud.maps.d/jasonrm-local.conf -l debug
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/master
[DEBUG   ] Missing configuration file: /Users/jason/git-local/salt-dev/cloud.providers
[DEBUG   ] Including configuration from '/Users/jason/git-local/salt-dev/cloud.providers.d/jasonrm-digitalocean.conf'
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud.providers.d/jasonrm-digitalocean.conf
[DEBUG   ] Including configuration from '/Users/jason/git-local/salt-dev/cloud.providers.d/jasonrm-ec2.conf'
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud.providers.d/jasonrm-ec2.conf
[DEBUG   ] Including configuration from '/Users/jason/git-local/salt-dev/cloud.providers.d/jasonrm-saltify.conf'
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud.providers.d/jasonrm-saltify.conf
[DEBUG   ] Missing configuration file: /Users/jason/git-local/salt-dev/cloud.profiles
[DEBUG   ] Including configuration from '/Users/jason/git-local/salt-dev/cloud.profiles.d/jasonrm-digitalocean.conf'
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud.profiles.d/jasonrm-digitalocean.conf
[DEBUG   ] Including configuration from '/Users/jason/git-local/salt-dev/cloud.profiles.d/jasonrm-ec2.conf'
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud.profiles.d/jasonrm-ec2.conf
[DEBUG   ] Including configuration from '/Users/jason/git-local/salt-dev/cloud.profiles.d/jasonrm-saltify.conf'
[DEBUG   ] Reading configuration from /Users/jason/git-local/salt-dev/cloud.profiles.d/jasonrm-saltify.conf
[DEBUG   ] Configuration file path: /Users/jason/git-local/salt-dev/cloud
[INFO    ] salt-cloud starting
[DEBUG   ] There is no Rackspace cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer HW salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Nova cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GCE cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Parallels cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Linode cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Joyent cloud provider configuration available. Not loading module.
[DEBUG   ] There is no AWS cloud provider configuration available. Not loading module
[DEBUG   ] There is no CloudStack cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GoGrid cloud provider configuration available. Not loading module.
[DEBUG   ] The 'botocore' library is not installed. The libcloud AWS support will be loaded instead.
[DEBUG   ] There is no Openstack cloud provider configuration available. Not loading module.
[DEBUG   ] Loading Digital Ocean cloud module
[DEBUG   ] Loading EC2 cloud compute module
[DEBUG   ] 'parallels.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'parallels.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.destroy' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_images' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'rackspace.reboot' has been marked as not supported. Removing from the list of supported cloud functions
[INFO    ] Applying map from 'cloud.maps.d/jasonrm-local.conf'.
[DEBUG   ] The 'saltify' cloud driver is unable to be optimized.
[DEBUG   ] The 'digital_ocean' cloud driver is unable to be optimized.
[DEBUG   ] There is no Rackspace cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer HW salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Nova cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GCE cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Parallels cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Linode cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Joyent cloud provider configuration available. Not loading module.
[DEBUG   ] There is no AWS cloud provider configuration available. Not loading module
[DEBUG   ] There is no CloudStack cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GoGrid cloud provider configuration available. Not loading module.
[DEBUG   ] The 'botocore' library is not installed. The libcloud AWS support will be loaded instead.
[DEBUG   ] There is no Openstack cloud provider configuration available. Not loading module.
[DEBUG   ] Loading Digital Ocean cloud module
[DEBUG   ] Loading EC2 cloud compute module
[DEBUG   ] 'parallels.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'parallels.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.destroy' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_images' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'rackspace.reboot' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] EC2 Request: https://ec2.us-east-1.amazonaws.com/?SignatureVersion=2&AWSAccessKeyId=[redacted]&Timestamp=2014-03-16T04%3A49%3A48Z&SignatureMethod=HmacSHA256&Version=2013-10-01&Signature=[redacted]&Action=DescribeInstances
[DEBUG   ] There is no Rackspace cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer HW salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Nova cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GCE cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Parallels cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Linode cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Joyent cloud provider configuration available. Not loading module.
[DEBUG   ] There is no AWS cloud provider configuration available. Not loading module
[DEBUG   ] There is no CloudStack cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GoGrid cloud provider configuration available. Not loading module.
[DEBUG   ] The 'botocore' library is not installed. The libcloud AWS support will be loaded instead.
[DEBUG   ] There is no Rackspace cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Openstack cloud provider configuration available. Not loading module.
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer HW salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] Loading Digital Ocean cloud module
[DEBUG   ] There is no Nova cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GCE cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Parallels cloud provider configuration available. Not loading module.
[DEBUG   ] Loading EC2 cloud compute module
[DEBUG   ] The SoftLayer Python Library needs to be installed in ordere to use the SoftLayer salt.cloud module. See: https://pypi.python.org/pypi/SoftLayer
[DEBUG   ] There is no Linode cloud provider configuration available. Not loading module.
[DEBUG   ] There is no Joyent cloud provider configuration available. Not loading module.
[DEBUG   ] There is no AWS cloud provider configuration available. Not loading module
[DEBUG   ] There is no CloudStack cloud provider configuration available. Not loading module.
[DEBUG   ] There is no GoGrid cloud provider configuration available. Not loading module.
[DEBUG   ] 'parallels.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'parallels.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] The 'botocore' library is not installed. The libcloud AWS support will be loaded instead.
[DEBUG   ] 'saltify.destroy' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] There is no Openstack cloud provider configuration available. Not loading module.
[DEBUG   ] 'saltify.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_images' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'rackspace.reboot' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] Loading Digital Ocean cloud module
[DEBUG   ] Loading EC2 cloud compute module
[DEBUG   ] 'parallels.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'parallels.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.destroy' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_sizes' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_images' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'saltify.avail_locations' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] 'rackspace.reboot' has been marked as not supported. Removing from the list of supported cloud functions
[DEBUG   ] https://api.digitalocean.com/droplets/?api_key=[redacted]&client_id=[redacted]
[DEBUG   ] EC2 Response Status Code: 200
The following virtual machines are set to be created:
  jasonrm.arch1
  jasonrm.ubuntu1

Proceed? [N/y]

Processing

... proceeding
[INFO    ] Calculating dependencies for jasonrm.arch1
[DEBUG   ] Got execution order 0 for jasonrm.arch1
[INFO    ] Calculating dependencies for jasonrm.ubuntu1
[DEBUG   ] Got execution order 0 for jasonrm.ubuntu1
[DEBUG   ] No make_master found in map
[DEBUG   ] Generating minion keys for 'jasonrm.arch1'
[INFO    ] Provisioning existing machine jasonrm.arch1
[INFO    ] Rendering deploy script: /Users/jason/git-local/salt-dev/cloud.deploy.d/bootstrap-salt.sh
[DEBUG   ] SaltEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] SaltEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Deploying 10.10.0.128 at 1394945529.0
[DEBUG   ] Attempting connection to host 10.10.0.128 on port 22
[DEBUG   ] SSH port 22 on 10.10.0.128 is available
[DEBUG   ] Using /Users/jason/git-local/salt-dev/keys/jasonrm-saltify as the key_filename
[DEBUG   ] Attempting to authenticate as root (try 1 of 15)
[DEBUG   ] SSH command: 'ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] date'
[DEBUG   ] Child Forked! PID: 91781  STDOUT_FD: 4  STDERR_FD: 7
[DEBUG   ] Terminal Command: /bin/sh -c ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] date
Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
[DEBUG   ] Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
Sun Mar 16 04:52:18 UTC 2014
[DEBUG   ] Sun Mar 16 04:52:18 UTC 2014
[DEBUG   ] Logging into 10.10.0.128:22 as root
[DEBUG   ] Using /Users/jason/git-local/salt-dev/keys/jasonrm-saltify as the key_filename
[DEBUG   ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] \'test -e \\"/tmp/.saltcloud\\"\''
[DEBUG   ] Child Forked! PID: 91782  STDOUT_FD: 5  STDERR_FD: 9
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] 'test -e \"/tmp/.saltcloud\"'
Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
Connection to 10.10.0.128 closed.
[DEBUG   ] Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
Connection to 10.10.0.128 closed.
[DEBUG   ] SSH command: 'ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] \'sh -c "( mkdir -p \\"/tmp/.saltcloud\\" && chmod 700 \\"/tmp/.saltcloud\\" )"\''
[DEBUG   ] Child Forked! PID: 91783  STDOUT_FD: 8  STDERR_FD: 11
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify [email protected] 'sh -c "( mkdir -p \"/tmp/.saltcloud\" && chmod 700 \"/tmp/.saltcloud\" )"'
Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
Connection to 10.10.0.128 closed.
[DEBUG   ] Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
Connection to 10.10.0.128 closed.
[DEBUG   ] Uploading /tmp/.saltcloud/minion.pem to 10.10.0.128 (scp)
[DEBUG   ] SCP command: 'scp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify /tmp/tmpy5z6ja [email protected]:/tmp/.saltcloud/minion.pem'
[DEBUG   ] Child Forked! PID: 91784  STDOUT_FD: 12  STDERR_FD: 14
[DEBUG   ] Terminal Command: /bin/sh -c scp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -oPasswordAuthentication=no -oChallengeResponseAuthentication=no -oPubkeyAuthentication=yes -oKbdInteractiveAuthentication=no -i /Users/jason/git-local/salt-dev/keys/jasonrm-saltify /tmp/tmpy5z6ja [email protected]:/tmp/.saltcloud/minion.pem
[DEBUG   ] Uploading file(PID 91784): '/tmp/.saltcloud/minion.pem'
Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.
[DEBUG   ] Warning: Permanently added '10.10.0.128' (RSA) to the list of known hosts.

Where it hangs

At this point it just hangs. The scp process (at pid 91784 above) is still running, and the file has been copied to the remote system. So I've really no idea what might be going on. I tried v2014.1.0 as well, and it hung in a similar fashion, perhaps even sooner on the first SSH command.

A horrid "fix"

diff --git a/salt/utils/cloud.py b/salt/utils/cloud.py
index f8a6c66..1c15c59 100644
--- a/salt/utils/cloud.py
+++ b/salt/utils/cloud.py
@@ -1263,7 +1263,7 @@ def scp_file(dest_path, contents, kwargs):
             )
         ])

-    cmd = 'scp {0} {1} {2[username]}@{2[hostname]}:{3}'.format(
+    cmd = 'scp -v {0} {1} {2[username]}@{2[hostname]}:{3}'.format(
         ' '.join(ssh_args), tmppath, kwargs, dest_path
     )
     log.debug('SCP command: {0!r}'.format(cmd))
@@ -1438,7 +1438,7 @@ def root_cmd(command, tty, sudo, **kwargs):
                 ssh_gateway_user, ssh_gateway, ssh_gateway_port
             )
         )
-    cmd = 'ssh {0} {1[username]}@{1[hostname]} {2}'.format(
+    cmd = 'ssh -v {0} {1[username]}@{1[hostname]} {2}'.format(
         ' '.join(ssh_args), kwargs, pipes.quote(command)
     )
     log.debug('SSH command: {0!r}'.format(cmd))

And then it works

With that change, to make the SSH and SCP commands verbose, everything seems to work correctly. So, yeah.

jasonrm.arch1:
    ----------
    deployed:
        True
jasonrm.ubuntu1:
    ----------
    deployed:
        True

jasonrm avatar Mar 16 '14 06:03 jasonrm

That's definitely a strange one! Glad you found a workaround -- we'll investigate this.

basepi avatar Mar 19 '14 19:03 basepi

I can confirm this issue, and that the workaround from @jasonrm works. I spent the last two hours trying to provision a Digital Ocean VM with salt-cloud from my Mac OS X 10.9 box running Salt 2014.1.3. No dice, it would boot but then the salt provisioning process hung forever trying to send the "date" command over SSH once it detected the VM was alive. As soon as I hacked cloud.py to add "-v" as Jason suggested, it worked.

If it matters, I installed Salt using homebrew following the official docs.

jhenry82 avatar May 04 '14 06:05 jhenry82

FWIW, I found this too using GCE, and I found the same work around fixes it. It must be some kind of timing or retry issue (my guess). I've tried it by installing from homebrew, uninstalled it, and installed salt in a virtualenv (2014.1.4), as well as using the latest develop branch, all with the same results.

Update: I also see a lot of this in the output:

Connection to 23.236.54.204 closed.
Transferred: sent 3824, received 2496 bytes, in 0.1 seconds
Bytes per second: sent 36311.1, received 23701.0
debug1: Exit status 0
Failed to connect to the Master, is the Salt Master running?

Pauses for 15 seconds, then goes on.

eric-plaster-myxer avatar May 07 '14 18:05 eric-plaster-myxer

Same issue here using the nova driver to drive OpenStack but also running salt-cloud on OS X. I guess the vt process spawning or communication behaves differently on OS X. I could also "fix" it by adding '-v' to the ssh_args lists. If there is no better fix, can someone include that just on OS X? Ie. if on OS X, add '-v'?

grischa avatar Jul 14 '14 04:07 grischa

I can confirm this bug on OS X. The "fix" by adding -v works also.

jgelens avatar Aug 19 '14 14:08 jgelens

Can someone try using the new 'use_sftp: True' flag in /etc/salt/cloud?

This will use sftp instead of relying on scp, I think this may solve the problem

gtmanfred avatar Aug 19 '14 14:08 gtmanfred

I found use_sftp to not solve the issue. Someone familiar with testing for the OS could add something along the lines of if on_osx(): ssh_args.append('-v')

grischa avatar Sep 23 '14 02:09 grischa

What version of salt are you using? We recently switched salt-cloud to sftp. v2014.7.0rc2 uses it, can't remember if v2014.1.11 does...

s0undt3ch avatar Sep 23 '14 06:09 s0undt3ch

EDIT: actually this one:

salt --version
salt 2014.7.0rc2 (Helium)

adding '-v' works reliably, I'd just add it for now

grischa avatar Sep 23 '14 06:09 grischa

Then you should already be using the sftp code, not scp...

s0undt3ch avatar Sep 23 '14 17:09 s0undt3ch

Hm, isn't root_cmd still used? And that does not actually use sftp.

However, sftp also hangs, at this point:

sftp> put /var/folders/hv/swpr7zk1765g2f21_nd8_94w0000gn/T/tmp_2oWae /tmp/.saltcloud-1d2950b7-6289-4268-abd3-5cb148f653d2/deploy.sh
Uploading /var/folders/hv/swpr7zk1765g2f21_nd8_94w0000gn/T/tmp_2oWae to /tmp/.saltcloud-1d2950b7-6289-4268-abd3-5cb148f653d2/deploy.sh
/var/folders/hv/swpr7zk1765g2f21_nd8_94w0000g   0%    0     0.0KB/s   --:-- ETA

Here is the relatively simple fix that makes it work on OS X:

diff --git a/salt/utils/cloud.py b/salt/utils/cloud.py
index 9c677dc..c1fd7ab 100644
--- a/salt/utils/cloud.py
+++ b/salt/utils/cloud.py
@@ -578,7 +578,7 @@ def wait_for_port(host, port=22, timeout=900, gateway=None):

     # Now we need to test the host via the gateway.
     # We will use netcat on the gateway to test the port
-    ssh_args = []
+    ssh_args = ['-v']
     ssh_args.extend([
         # Don't add new hosts to the host key database
         '-oStrictHostKeyChecking=no',
@@ -1403,6 +1403,7 @@ def scp_file(dest_path, contents, kwargs):
     log.debug('Uploading {0} to {1}'.format(dest_path, kwargs['hostname']))

     ssh_args = [
+        '-v',
         # Don't add new hosts to the host key database
         '-oStrictHostKeyChecking=no',
         # Set hosts key database path to /dev/null, ie, non-existing
@@ -1514,6 +1515,7 @@ def sftp_file(dest_path, contents, kwargs):
     log.debug('Uploading {0} to {1} (sfcp)'.format(dest_path, kwargs['hostname']))

     ssh_args = [
+        '-v',
         # Don't add new hosts to the host key database
         '-oStrictHostKeyChecking=no',
         # Set hosts key database path to /dev/null, ie, non-existing
@@ -1624,7 +1626,7 @@ def root_cmd(command, tty, sudo, allow_failure=False, **kwargs):
             command = 'sudo {0}'.format(command)
         log.debug('Using sudo to run command {0}'.format(command))

-    ssh_args = []
+    ssh_args = ['-v']

     if tty:
         # Use double `-t` on the `ssh` command, it's necessary when `sudo` has

So, I maintain that this please be added for OS X until someone finds out and fixes the real bug. It's better to be able to use salt with some debug output than to not be able to use it at all, isn't it?

grischa avatar Sep 25 '14 07:09 grischa

I though you were referring to the file uploads using scp

s0undt3ch avatar Sep 25 '14 07:09 s0undt3ch

Hi all - I am going back through some old issues. With the releases of 2014.7.x and 2015.5.x, is this still an issue? Or has it been resolved?

rallytime avatar Jun 02 '15 15:06 rallytime

Since we haven't heard anything back here, I am going to close this bug. If this issue pops up again, please leave a comment and we will be glad to re-open. Thanks!

rallytime avatar Jun 16 '15 23:06 rallytime