summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRene Moser <mail@renemoser.net>2015-12-03 01:12:34 +0100
committerBrian Coca <brian.coca+git@gmail.com>2015-12-05 00:55:36 -0500
commitdf4b59d74150cfa7f681e6e6a9cd3d530202c48f (patch)
tree2c5d20a4da740bf4979c5f12ac93c377144bf188
parent444f8c81aa0529adb78be31bb644ff87efe97e74 (diff)
downloadansible-modules-extras-df4b59d74150cfa7f681e6e6a9cd3d530202c48f.tar.gz
cloudstack: fixes and improvements
- cs_affinitygroup: add project support Project support in CloudStack for affinity groups is going to be fixed/implemented in the near future, this module should already support. - cs_affinitygroup: fix missing returns in doc - cs_firewall: argument zone is missing, default zone is always used. credits for reporting and fixing to @atsaki closes #1320 - cs_instance: fix user_data base64 encoding fails if not a string - modified commit from devel as it had updates to cs_volume which is a 2.1 module
-rw-r--r--cloud/cloudstack/cs_affinitygroup.py24
-rw-r--r--cloud/cloudstack/cs_firewall.py7
-rw-r--r--cloud/cloudstack/cs_instance.py2
3 files changed, 32 insertions, 1 deletions
diff --git a/cloud/cloudstack/cs_affinitygroup.py b/cloud/cloudstack/cs_affinitygroup.py
index 5a7cb5f9..b1dc075c 100644
--- a/cloud/cloudstack/cs_affinitygroup.py
+++ b/cloud/cloudstack/cs_affinitygroup.py
@@ -57,6 +57,11 @@ options:
- Account the affinity group is related to.
required: false
default: null
+ project:
+ description:
+ - Name of the project the affinity group is related to.
+ required: false
+ default: null
poll_async:
description:
- Poll async jobs until job has finished.
@@ -101,6 +106,21 @@ affinity_type:
returned: success
type: string
sample: host anti-affinity
+project:
+ description: Name of project the affinity group is related to.
+ returned: success
+ type: string
+ sample: Production
+domain:
+ description: Domain the affinity group is related to.
+ returned: success
+ type: string
+ sample: example domain
+account:
+ description: Account the affinity group is related to.
+ returned: success
+ type: string
+ sample: example account
'''
try:
@@ -128,6 +148,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
affinity_group = self.module.params.get('name')
args = {}
+ args['projectid'] = self.get_project(key='id')
args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id')
@@ -163,6 +184,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
args['name'] = self.module.params.get('name')
args['type'] = self.get_affinity_type()
args['description'] = self.module.params.get('description')
+ args['projectid'] = self.get_project(key='id')
args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id')
@@ -185,6 +207,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
args = {}
args['name'] = self.module.params.get('name')
+ args['projectid'] = self.get_project(key='id')
args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id')
@@ -209,6 +232,7 @@ def main():
state = dict(choices=['present', 'absent'], default='present'),
domain = dict(default=None),
account = dict(default=None),
+ project = dict(default=None),
poll_async = dict(choices=BOOLEANS, default=True),
))
diff --git a/cloud/cloudstack/cs_firewall.py b/cloud/cloudstack/cs_firewall.py
index 4f4c1e78..9834dd67 100644
--- a/cloud/cloudstack/cs_firewall.py
+++ b/cloud/cloudstack/cs_firewall.py
@@ -99,6 +99,12 @@ options:
- Name of the project the firewall rule is related to.
required: false
default: null
+ zone:
+ description:
+ - Name of the zone in which the virtual machine is in.
+ - If not set, default zone is used.
+ required: false
+ default: null
poll_async:
description:
- Poll async jobs until job has finished.
@@ -404,6 +410,7 @@ def main():
start_port = dict(type='int', aliases=['port'], default=None),
end_port = dict(type='int', default=None),
state = dict(choices=['present', 'absent'], default='present'),
+ zone = dict(default=None),
domain = dict(default=None),
account = dict(default=None),
project = dict(default=None),
diff --git a/cloud/cloudstack/cs_instance.py b/cloud/cloudstack/cs_instance.py
index 8cf0672e..2b662a20 100644
--- a/cloud/cloudstack/cs_instance.py
+++ b/cloud/cloudstack/cs_instance.py
@@ -558,7 +558,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
def get_user_data(self):
user_data = self.module.params.get('user_data')
if user_data:
- user_data = base64.b64encode(user_data)
+ user_data = base64.b64encode(str(user_data))
return user_data
def get_details(self):