cs_instance: fix error when state destroyed but querying user_data (#37175)

(cherry picked from commit 190d3fbbed)
pull/37178/head
René Moser 7 years ago committed by GitHub
parent bfceaf696c
commit 193687851b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save