From e62fbf5fba020c6318478f5cd0e42331bfd6ab17 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Tue, 11 Aug 2015 18:03:50 +0200 Subject: [PATCH] cloudstack: add get_result() in utils to return common results --- lib/ansible/module_utils/cloudstack.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index 752defec2b6..04f82d0742b 100644 --- a/lib/ansible/module_utils/cloudstack.py +++ b/lib/ansible/module_utils/cloudstack.py @@ -366,3 +366,18 @@ class AnsibleCloudStack: break time.sleep(2) return job + + + def get_result(self, resource): + if resource: + if 'id' in resource: + self.result['id'] = resource['id'] + if 'project' in resource: + self.result['project'] = resource['project'] + if 'domain' in resource: + self.result['domain'] = resource['domain'] + if 'account' in resource: + self.result['account'] = resource['account'] + if 'zonename' in resource: + self.result['zone'] = resource['zonename'] + return self.result