From 193687851bafd262a7311818276d3ad5df0ef383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Thu, 8 Mar 2018 11:40:31 +0100 Subject: [PATCH] cs_instance: fix error when state destroyed but querying user_data (#37175) (cherry picked from commit 190d3fbbed19c04f207f9b0cc94efe90cfc7ec21) --- lib/ansible/modules/cloud/cloudstack/cs_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/cloudstack/cs_instance.py b/lib/ansible/modules/cloud/cloudstack/cs_instance.py index e7e60f62c6d..06a25294199 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_instance.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_instance.py @@ -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