Merge pull request #1322 from resmo/for-ansible

[v2] cloudstack fixes
reviewable/pr18780/r1
Brian Coca 9 years ago
commit 5e52b2f091

@ -57,6 +57,11 @@ options:
- Account the affinity group is related to. - Account the affinity group is related to.
required: false required: false
default: null default: null
project:
description:
- Name of the project the affinity group is related to.
required: false
default: null
poll_async: poll_async:
description: description:
- Poll async jobs until job has finished. - Poll async jobs until job has finished.
@ -101,6 +106,21 @@ affinity_type:
returned: success returned: success
type: string type: string
sample: host anti-affinity 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: try:
@ -128,6 +148,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
affinity_group = self.module.params.get('name') affinity_group = self.module.params.get('name')
args = {} args = {}
args['projectid'] = self.get_project(key='id')
args['account'] = self.get_account('name') args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id') args['domainid'] = self.get_domain('id')
@ -163,6 +184,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
args['name'] = self.module.params.get('name') args['name'] = self.module.params.get('name')
args['type'] = self.get_affinity_type() args['type'] = self.get_affinity_type()
args['description'] = self.module.params.get('description') args['description'] = self.module.params.get('description')
args['projectid'] = self.get_project(key='id')
args['account'] = self.get_account('name') args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id') args['domainid'] = self.get_domain('id')
@ -185,6 +207,7 @@ class AnsibleCloudStackAffinityGroup(AnsibleCloudStack):
args = {} args = {}
args['name'] = self.module.params.get('name') args['name'] = self.module.params.get('name')
args['projectid'] = self.get_project(key='id')
args['account'] = self.get_account('name') args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id') args['domainid'] = self.get_domain('id')
@ -209,6 +232,7 @@ def main():
state = dict(choices=['present', 'absent'], default='present'), state = dict(choices=['present', 'absent'], default='present'),
domain = dict(default=None), domain = dict(default=None),
account = dict(default=None), account = dict(default=None),
project = dict(default=None),
poll_async = dict(choices=BOOLEANS, default=True), poll_async = dict(choices=BOOLEANS, default=True),
)) ))

@ -99,6 +99,12 @@ options:
- Name of the project the firewall rule is related to. - Name of the project the firewall rule is related to.
required: false required: false
default: null 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: poll_async:
description: description:
- Poll async jobs until job has finished. - Poll async jobs until job has finished.
@ -404,6 +410,7 @@ def main():
start_port = dict(type='int', aliases=['port'], default=None), start_port = dict(type='int', aliases=['port'], default=None),
end_port = dict(type='int', default=None), end_port = dict(type='int', default=None),
state = dict(choices=['present', 'absent'], default='present'), state = dict(choices=['present', 'absent'], default='present'),
zone = dict(default=None),
domain = dict(default=None), domain = dict(default=None),
account = dict(default=None), account = dict(default=None),
project = dict(default=None), project = dict(default=None),

@ -558,7 +558,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
def get_user_data(self): def get_user_data(self):
user_data = self.module.params.get('user_data') user_data = self.module.params.get('user_data')
if user_data: if user_data:
user_data = base64.b64encode(user_data) user_data = base64.b64encode(str(user_data))
return user_data return user_data
def get_details(self): def get_details(self):

@ -255,10 +255,8 @@ class AnsibleCloudStackVolume(AnsibleCloudStack):
if not disk_offering: if not disk_offering:
return None return None
args = {} # Do not add domain filter for disk offering listing.
args['domainid'] = self.get_domain(key='id') disk_offerings = self.cs.listDiskOfferings()
disk_offerings = self.cs.listDiskOfferings(**args)
if disk_offerings: if disk_offerings:
for d in disk_offerings['diskoffering']: for d in disk_offerings['diskoffering']:
if disk_offering in [d['displaytext'], d['name'], d['id']]: if disk_offering in [d['displaytext'], d['name'], d['id']]:
@ -272,6 +270,7 @@ class AnsibleCloudStackVolume(AnsibleCloudStack):
args['account'] = self.get_account(key='name') args['account'] = self.get_account(key='name')
args['domainid'] = self.get_domain(key='id') args['domainid'] = self.get_domain(key='id')
args['projectid'] = self.get_project(key='id') args['projectid'] = self.get_project(key='id')
args['displayvolume'] = self.module.params.get('display_volume')
args['type'] = 'DATADISK' args['type'] = 'DATADISK'
volumes = self.cs.listVolumes(**args) volumes = self.cs.listVolumes(**args)

Loading…
Cancel
Save