salt cloud error destroy vm when renamed aws
Looks there is an issue destroying vm's when rename_on_destroy is True on AWS. Works fine when rename_on_destroy is false.
The vm get's terminated in aws but it's minion key will still remain in salt.
root@server:~# salt-cloud -d ship-us-east-01
[INFO ] salt-cloud starting
The following virtual machines are set to be destroyed:
ec2_ship_private_us_east:
ec2:
ship-us-east-01
ec2_ubuntu_private_us_east:
ec2:
ship-us-east-01
ec2_ubuntu_public_us_east:
ec2:
ship-us-east-01
Proceed? [N/y] y
... proceeding
[INFO ] Destroying in non-parallel mode.
[INFO ] Renaming ship-us-east-01 to ship-us-east-01-DEL3f35b3ee02664b5da8813302f18b1fda
[INFO ] Machine will be identified as ship-us-east-01-DEL3f35b3ee02664b5da8813302f18b1fda until it has been cleaned up.
[INFO ] [{'instanceId': 'i-f5c28ed9', 'currentState': {'code': '32', 'name': 'shutting-down'}, 'previousState': {'code': '16', 'name': 'running'}}]
[ERROR ] There was an error destroying machines: 'instanceId'
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/cloud/cli.py", line 266, in run
ret = mapper.destroy(names, cached=True)
File "/usr/lib/pymodules/python2.7/salt/cloud/__init__.py", line 646, in destroy
ret = self.clouds[fun](name)
File "/usr/lib/pymodules/python2.7/salt/cloud/clouds/ec2.py", line 1800, in destroy
instance_id = node_metadata['instanceId']
KeyError: 'instanceId'
root@server:~# salt --versions-report
Salt: 2014.1.7
Python: 2.7.3 (default, Feb 27 2014, 19:58:35)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.10
PyZMQ: 13.0.0
ZMQ: 3.2.2
Thanks for the report, we'll investigate this issue.
@jacksoncage - I think this may have been fixed on the 2014.7 and develop branches with @UtahDave 's fixes in #1590. Can you test on a newer version of the 2014.7 branch to confirm that this is the case?
I have this problem with .13, I get this error with salt-cloud -a rename , and with salt-cloud -d:
[email protected]:/etc/salt# salt-cloud -y -d mydemo [INFO ] salt-cloud starting [INFO ] Destroying in non-parallel mode. [INFO ] Renaming mydemo to mydemo-DELd52c3122937943aea2e241ed84d66e36 [ERROR ] There was an error destroying machines: 'mydemo' Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/salt/cloud/cli.py", line 266, in run ret = mapper.destroy(names, cached=True) File "/usr/lib/python2.7/dist-packages/salt/cloud/init.py", line 646, in destroy ret = self.cloudsfun File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py", line 1831, in destroy rename(name, kwargs={'newname': newname}, call='action') File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py", line 1778, in rename set_tags(name, {'Name': kwargs['newname']}, call='action') File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py", line 1662, in set_tags instance_id = _get_node(name, location)[name]['instanceId'] KeyError: 'mydemo'
Versions: Salt: 2014.1.13 Python: 2.7.8 (default, Sep 9 2014, 22:08:43) Jinja2: 2.7.3 M2Crypto: 0.21.1 msgpack-python: 0.1.10 msgpack-pure: Not Installed pycrypto: 2.6.1 PyYAML: 3.11 PyZMQ: 14.3.1 ZMQ: 4.0.4
Looks like I missed a number when I was referencing the fix earlier. The fix is #15901.
@larkinrobert thanks for the update. Are you in a position to test on a newer version/tag based off of the 2014.7 branch? We cut the 2014.7.0 release yesterday, which is currently in the packaging stage, and will be announced officially early next week.
Since we haven't heard back from anyone in a while, I'm going to close this one out. If this problem persists, please leave a comment and we will be happy to re-open!