cs_instance: fix error when state destroyed but querying user_data

This commit is contained in:
Rene Moser 2018-03-07 21:49:19 +01:00 committed by René Moser
parent 6c8d40f653
commit 190d3fbbed

View file

@ -460,7 +460,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
return instance['userdata']
user_data = ""
if self.get_user_data() is not None:
if self.get_user_data() is not None and instance.get('id'):
res = self.query_api('getVirtualMachineUserData', virtualmachineid=instance['id'])
user_data = res['virtualmachineuserdata'].get('userdata', "")
return user_data