From 7806d3d134150e41612b14f6432e7cfd84787f08 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Fri, 10 Jul 2015 17:36:20 +0200 Subject: [PATCH] cloudstack: cs_instance: fix missing resource error in check mode if instance is not yet present --- lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py index e08d85eea91..dc8d48ebb88 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py @@ -485,8 +485,10 @@ class AnsibleCloudStackInstance(AnsibleCloudStack): instance = self.deploy_instance() else: instance = self.update_instance(instance) - - instance = self.ensure_tags(resource=instance, resource_type='UserVm') + + # In check mode, we do not necessarely have an instance + if instance: + instance = self.ensure_tags(resource=instance, resource_type='UserVm') return instance