cloudstack: fix pep8 cs_pod

pull/25121/head
Rene Moser 8 years ago committed by René Moser
parent 3ef37e88fe
commit 9cbae80c3b

@ -155,8 +155,14 @@ zone:
sample: ch-gva-2
'''
# import cloudstack common
from ansible.module_utils.cloudstack import *
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
CloudStackException,
cs_argument_spec,
cs_required_together
)
class AnsibleCloudStackPod(AnsibleCloudStack):
@ -171,21 +177,20 @@ class AnsibleCloudStackPod(AnsibleCloudStack):
}
self.pod = None
def _get_common_pod_args(self):
args = {}
args['name'] = self.module.params.get('name')
args['zoneid'] = self.get_zone(key='id')
args['startip'] = self.module.params.get('start_ip')
args['endip'] = self.module.params.get('end_ip')
args['netmask'] = self.module.params.get('netmask')
args['gateway'] = self.module.params.get('gateway')
args = {
'name': self.module.params.get('name'),
'zoneid': self.get_zone(key='id'),
'startip': self.module.params.get('start_ip'),
'endip': self.module.params.get('end_ip'),
'netmask': self.module.params.get('netmask'),
'gateway': self.module.params.get('gateway')
}
state = self.module.params.get('state')
if state in ['enabled', 'disabled']:
args['allocationstate'] = state.capitalize()
return args
def get_pod(self):
if not self.pod:
args = {}
@ -206,7 +211,6 @@ class AnsibleCloudStackPod(AnsibleCloudStack):
self.pod = pods['pod'][0]
return self.pod
def present_pod(self):
pod = self.get_pod()
if pod:
@ -215,7 +219,6 @@ class AnsibleCloudStackPod(AnsibleCloudStack):
pod = self._create_pod()
return pod
def _create_pod(self):
required_params = [
'start_ip',
@ -234,7 +237,6 @@ class AnsibleCloudStackPod(AnsibleCloudStack):
pod = res['pod']
return pod
def _update_pod(self):
pod = self.get_pod()
args = self._get_common_pod_args()
@ -250,15 +252,14 @@ class AnsibleCloudStackPod(AnsibleCloudStack):
pod = res['pod']
return pod
def absent_pod(self):
pod = self.get_pod()
if pod:
self.result['changed'] = True
args = {}
args['id'] = pod['id']
args = {
'id': pod['id']
}
if not self.module.check_mode:
res = self.cs.deletePod(**args)
if 'errortext' in res:
@ -269,13 +270,13 @@ class AnsibleCloudStackPod(AnsibleCloudStack):
def main():
argument_spec = cs_argument_spec()
argument_spec.update(dict(
id = dict(default=None),
id=dict(),
name=dict(required=True),
gateway = dict(default=None),
netmask = dict(default=None),
start_ip = dict(default=None),
end_ip = dict(default=None),
zone = dict(default=None),
gateway=dict(),
netmask=dict(),
start_ip=dict(),
end_ip=dict(),
zone=dict(),
state=dict(choices=['present', 'enabled', 'disabled', 'absent'], default='present'),
))
@ -300,7 +301,6 @@ def main():
module.exit_json(**result)
# import module snippets
from ansible.module_utils.basic import *
if __name__ == '__main__':
main()

@ -170,7 +170,6 @@ lib/ansible/modules/cloud/cloudstack/cs_instance_facts.py
lib/ansible/modules/cloud/cloudstack/cs_instancegroup.py
lib/ansible/modules/cloud/cloudstack/cs_iso.py
lib/ansible/modules/cloud/cloudstack/cs_nic.py
lib/ansible/modules/cloud/cloudstack/cs_pod.py
lib/ansible/modules/cloud/cloudstack/cs_portforward.py
lib/ansible/modules/cloud/cloudstack/cs_project.py
lib/ansible/modules/cloud/cloudstack/cs_router.py

Loading…
Cancel
Save