From 249b7bf9695c8ef1950fa760ad2a115fdae15871 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sun, 23 Aug 2015 00:01:52 +0200 Subject: [PATCH 1/4] cloudstack: cs_instance: fix ip address may not be set on default nic --- cloud/cloudstack/cs_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/cloudstack/cs_instance.py b/cloud/cloudstack/cs_instance.py index 201449b870d..4ead1317b2f 100644 --- a/cloud/cloudstack/cs_instance.py +++ b/cloud/cloudstack/cs_instance.py @@ -779,7 +779,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack): self.result['affinity_groups'] = affinity_groups if 'nic' in instance: for nic in instance['nic']: - if nic['isdefault']: + if nic['isdefault'] and 'ipaddress' in nic: self.result['default_ip'] = nic['ipaddress'] return self.result From a279207c7bb05c58ae1fcc2d682fad345e656dc0 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sun, 23 Aug 2015 00:04:51 +0200 Subject: [PATCH 2/4] cloudstack: cs_portforward: fix returns for int casting * missing self. * variable must be named portforwarding_rule, not resource --- cloud/cloudstack/cs_portforward.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud/cloudstack/cs_portforward.py b/cloud/cloudstack/cs_portforward.py index 2fc14aa5ed3..f2f87b660ef 100644 --- a/cloud/cloudstack/cs_portforward.py +++ b/cloud/cloudstack/cs_portforward.py @@ -361,9 +361,9 @@ class AnsibleCloudStackPortforwarding(AnsibleCloudStack): super(AnsibleCloudStackPortforwarding, self).get_result(portforwarding_rule) if portforwarding_rule: # Bad bad API does not always return int when it should. - for search_key, return_key in returns_to_int.iteritems(): - if search_key in resource: - self.result[return_key] = int(resource[search_key]) + for search_key, return_key in self.returns_to_int.iteritems(): + if search_key in portforwarding_rule: + self.result[return_key] = int(portforwarding_rule[search_key]) return self.result From 94614d0454e908fe5151451f1c3f23397f3ad747 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sun, 23 Aug 2015 00:06:37 +0200 Subject: [PATCH 3/4] cloudstack: cs_staticnat: fix wrong class name used --- cloud/cloudstack/cs_staticnat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/cloudstack/cs_staticnat.py b/cloud/cloudstack/cs_staticnat.py index 500c533915b..4b73d86e32b 100644 --- a/cloud/cloudstack/cs_staticnat.py +++ b/cloud/cloudstack/cs_staticnat.py @@ -154,7 +154,7 @@ from ansible.module_utils.cloudstack import * class AnsibleCloudStackStaticNat(AnsibleCloudStack): def __init__(self, module): - super(AnsibleCloudStackPortforwarding, self).__init__(module) + super(AnsibleCloudStackStaticNat, self).__init__(module) self.returns = { 'virtualmachinedisplayname': 'vm_display_name', 'virtualmachinename': 'vm_name', From 485670145729be8e2eb5f19bd06c7d4593ba3e84 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sun, 23 Aug 2015 00:09:38 +0200 Subject: [PATCH 4/4] cloudstack: cs_domain: rename argument cleanup to clean_up for consistency --- cloud/cloudstack/cs_domain.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud/cloudstack/cs_domain.py b/cloud/cloudstack/cs_domain.py index c9f345a00c2..27410040aec 100644 --- a/cloud/cloudstack/cs_domain.py +++ b/cloud/cloudstack/cs_domain.py @@ -37,7 +37,7 @@ options: - Network domain for networks in the domain. required: false default: null - cleanup: + clean_up: description: - Clean up all domain resources like child domains and accounts. - Considered on C(state=absent). @@ -225,7 +225,7 @@ class AnsibleCloudStackDomain(AnsibleCloudStack): if not self.module.check_mode: args = {} args['id'] = domain['id'] - args['cleanup'] = self.module.params.get('cleanup') + args['cleanup'] = self.module.params.get('clean_up') res = self.cs.deleteDomain(**args) if 'errortext' in res: @@ -244,7 +244,7 @@ def main(): path = dict(required=True), state = dict(choices=['present', 'absent'], default='present'), network_domain = dict(default=None), - cleanup = dict(choices=BOOLEANS, default=False), + clean_up = dict(choices=BOOLEANS, default=False), poll_async = dict(choices=BOOLEANS, default=True), api_key = dict(default=None), api_secret = dict(default=None, no_log=True),