saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.16k stars 5.48k forks source link

Azure: Failed to create VM, KeyError 'ssh_host' or 'ssh_password'... #19618

Closed flavianh closed 9 years ago

flavianh commented 9 years ago

I think this is linked to the new saltify driver I don't know why it gets activated when I am using my azure provider. However now my master does not connect to my minions. Here is the sanitized traceback:

[INFO    ] 0 attached to <vm_name> (aka <vm_name>)
[INFO    ] Rendering deploy script: /usr/local/lib/python2.7/dist-packages/salt/cloud/deploy/bootstrap-salt.sh
[ERROR   ] Failed to create VM <vm_name>. Configuration value 'ssh_host' needs to be set
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 1240, in create
    output = self.clouds[func](vm_)
  File "/usr/local/lib/python2.7/dist-packages/salt/cloud/clouds/msazure.py", line 734, in create
    for key, value in salt.utils.cloud.bootstrap(vm_, __opts__).items():
  File "/usr/local/lib/python2.7/dist-packages/salt/utils/cloud.py", line 336, in bootstrap
    'host': vm_['ssh_host'],
KeyError: 'ssh_host'

My profile:

azure-small:
  provider: azure-config
  image: '<my_image>'
  size: Small
  location: 'West Europe'
  ssh_username: <user>          <- I added that to counter a missing key
  ssh_password: <password>   <- I added that to counter a missing key
  username: <user>
  password: <password>
  slot: production
  media_link: '<media_link>'

My map file is a regular:

azure-small:
  - <vm_name>:
      port: 25                               <- I think it does not work with 22 either anyway

And my version

           Salt: 2015.2.0-78-g717655c
         Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
         Jinja2: 2.7.3
       M2Crypto: 0.21.1
 msgpack-python: 0.4.4
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.4.1
           RAET: Not Installed
            ZMQ: 4.0.5
           Mako: Not Installed

I think this got merged by mistake since the unit tests only check for the VM existing and the error does not stop the deployment.

rallytime commented 9 years ago

Thanks for the report, as usual, @traxair!

techhat commented 9 years ago

@traxair, I'm not seeing how this would be linked to saltify, other than shared code between the two drivers.

ssh_host (or some version of it) should be passed in by the cloud driver. When did this start happening for you?

flavianh commented 9 years ago

It happened during my latest pull, which was 2 days ago. Previous pull was 4 days ago I think

flavianh commented 9 years ago

Fixed in #19752

rallytime commented 9 years ago

@traxair Awesome! My pull request was meant to fix another issue, but I am glad that it cleared this one up as well. Thanks for following up with your issue and closing it. :)

flavianh commented 9 years ago

False alarm :(

[INFO    ] 0 attached to traxit-mac-02 (aka traxit-mac-02)
[ERROR   ] Failed to deploy 'traxit-mac-02'. Error: Cannot deploy salt in a VM if the 'ssh_keyfile' setting is not set and 'sshpass' binary is not present on
e system for the password.
Traceback (most recent call last):
  File "/srv/salt/salt/salt/cloud/__init__.py", line 2076, in run_map
    profile, local_master=local_master
  File "/srv/salt/salt/salt/cloud/__init__.py", line 1240, in create
    output = self.clouds[func](vm_)
  File "/srv/salt/salt/salt/cloud/clouds/msazure.py", line 734, in create
    for key, value in salt.utils.cloud.bootstrap(vm_, __opts__).items():
  File "/srv/salt/salt/salt/utils/cloud.py", line 308, in bootstrap
    'Cannot deploy salt in a VM if the \'ssh_keyfile\' setting '
SaltCloudSystemExit: Cannot deploy salt in a VM if the 'ssh_keyfile' setting is not set and 'sshpass' binary is not present on the system for the password.
           Salt: 2015.2.0-170-g0b3c3f8
         Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
         Jinja2: 2.7.3
       M2Crypto: 0.21.1
 msgpack-python: 0.4.3
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.4.1
           RAET: Not Installed
            ZMQ: 4.0.5
           Mako: Not Installed
rallytime commented 9 years ago

@traxair Wait, where are you running this? Develop or 2015.2 branch? That check shouldn't exists anymore...

I'm not sure if this fix has been completely merged forward yet. I know it's in 2015.2 as of yesterday, but I don't think it's been merged into develop yet.

flavianh commented 9 years ago

Ok! I will switch to 2015.2 then, should I leave this open until it's in develop? EDIT: 2015-2 completely broke the azure driver so I can't even check if it works again, can we rebase the one from develop into 2015-2?

rallytime commented 9 years ago

Up to you! I've just created #19792, so those fixes should be in develop once that pull request gets merged in.

flavianh commented 9 years ago

This seems to have gone away

rallytime commented 9 years ago

Great! Glad this is working now. :)