mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: cs_instancegroup: fix pep8 (#26534)
This commit is contained in:
parent
804f40f7a5
commit
3050856f2a
2 changed files with 25 additions and 25 deletions
|
@ -107,8 +107,13 @@ project:
|
|||
sample: example project
|
||||
'''
|
||||
|
||||
# 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 AnsibleCloudStackInstanceGroup(AnsibleCloudStack):
|
||||
|
@ -117,38 +122,36 @@ class AnsibleCloudStackInstanceGroup(AnsibleCloudStack):
|
|||
super(AnsibleCloudStackInstanceGroup, self).__init__(module)
|
||||
self.instance_group = None
|
||||
|
||||
|
||||
def get_instance_group(self):
|
||||
if self.instance_group:
|
||||
return self.instance_group
|
||||
|
||||
name = self.module.params.get('name')
|
||||
|
||||
args = {}
|
||||
args['account'] = self.get_account('name')
|
||||
args['domainid'] = self.get_domain('id')
|
||||
args['projectid'] = self.get_project('id')
|
||||
|
||||
args = {
|
||||
'account': self.get_account('name'),
|
||||
'domainid': self.get_domain('id'),
|
||||
'projectid': self.get_project('id'),
|
||||
}
|
||||
instance_groups = self.cs.listInstanceGroups(**args)
|
||||
if instance_groups:
|
||||
for g in instance_groups['instancegroup']:
|
||||
if name in [ g['name'], g['id'] ]:
|
||||
if name in [g['name'], g['id']]:
|
||||
self.instance_group = g
|
||||
break
|
||||
return self.instance_group
|
||||
|
||||
|
||||
def present_instance_group(self):
|
||||
instance_group = self.get_instance_group()
|
||||
if not instance_group:
|
||||
self.result['changed'] = True
|
||||
|
||||
args = {}
|
||||
args['name'] = self.module.params.get('name')
|
||||
args['account'] = self.get_account('name')
|
||||
args['domainid'] = self.get_domain('id')
|
||||
args['projectid'] = self.get_project('id')
|
||||
|
||||
args = {
|
||||
'name': self.module.params.get('name'),
|
||||
'account': self.get_account('name'),
|
||||
'domainid': self.get_domain('id'),
|
||||
'projectid': self.get_project('id'),
|
||||
}
|
||||
if not self.module.check_mode:
|
||||
res = self.cs.createInstanceGroup(**args)
|
||||
if 'errortext' in res:
|
||||
|
@ -156,7 +159,6 @@ class AnsibleCloudStackInstanceGroup(AnsibleCloudStack):
|
|||
instance_group = res['instancegroup']
|
||||
return instance_group
|
||||
|
||||
|
||||
def absent_instance_group(self):
|
||||
instance_group = self.get_instance_group()
|
||||
if instance_group:
|
||||
|
@ -171,11 +173,11 @@ class AnsibleCloudStackInstanceGroup(AnsibleCloudStack):
|
|||
def main():
|
||||
argument_spec = cs_argument_spec()
|
||||
argument_spec.update(dict(
|
||||
name = dict(required=True),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
domain = dict(default=None),
|
||||
account = dict(default=None),
|
||||
project = dict(default=None),
|
||||
name=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
domain=dict(),
|
||||
account=dict(),
|
||||
project=dict(),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
@ -200,7 +202,6 @@ def main():
|
|||
|
||||
module.exit_json(**result)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -87,7 +87,6 @@ lib/ansible/modules/cloud/cloudscale/cloudscale_server.py
|
|||
lib/ansible/modules/cloud/cloudstack/cs_configuration.py
|
||||
lib/ansible/modules/cloud/cloudstack/cs_instance.py
|
||||
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_portforward.py
|
||||
|
|
Loading…
Reference in a new issue