mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
PEP8 fixes for smartos module
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
374872cac4
commit
dd9db65a9a
4 changed files with 9 additions and 13 deletions
|
@ -197,17 +197,17 @@ class Imgadm(object):
|
|||
self.changed = True
|
||||
else:
|
||||
# Type is ignored by imgadm(1M) here
|
||||
cmd += ' -d %s' % (source)
|
||||
cmd += ' -d %s' % source
|
||||
(rc, stdout, stderr) = self.module.run_command(cmd)
|
||||
|
||||
if rc != 0:
|
||||
self.module.fail_json(msg='Failed to remove source: {0}'.format(self.errmsg(stderr)))
|
||||
|
||||
regex = 'Do not have image source "%s", no change' % (source)
|
||||
regex = 'Do not have image source "%s", no change' % source
|
||||
if re.match(regex, stdout):
|
||||
self.changed = False
|
||||
|
||||
regex = 'Deleted ".*" image source "%s"' % (source)
|
||||
regex = 'Deleted ".*" image source "%s"' % source
|
||||
if re.match(regex, stdout):
|
||||
self.changed = True
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ RETURN = '''
|
|||
'''
|
||||
|
||||
import json
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
|
@ -101,11 +100,9 @@ def main():
|
|||
|
||||
image_facts = ImageFacts(module)
|
||||
|
||||
data = {}
|
||||
data['smartos_images'] = image_facts.return_all_installed_images()
|
||||
data = dict(smartos_images=image_facts.return_all_installed_images())
|
||||
|
||||
module.exit_json(ansible_facts=data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -366,7 +366,7 @@ def get_vm_prop(module, uuid, prop):
|
|||
stdout_json = json.loads(stdout)
|
||||
except Exception as e:
|
||||
module.fail_json(
|
||||
msg='Invalid JSON returned by vmadm for uuid lookup of {0}'.format(uuid),
|
||||
msg='Invalid JSON returned by vmadm for uuid lookup of {0}'.format(prop),
|
||||
details=to_native(e), exception=traceback.format_exc())
|
||||
|
||||
if len(stdout_json) > 0 and prop in stdout_json[0]:
|
||||
|
@ -524,15 +524,15 @@ def create_payload(module, uuid):
|
|||
# drop the mkstemp call and rely on ANSIBLE_KEEP_REMOTE_FILES to retain
|
||||
# the payload (thus removing the `save_payload` option).
|
||||
fname = tempfile.mkstemp()[1]
|
||||
fh = open(fname, 'w')
|
||||
os.chmod(fname, 0o400)
|
||||
fh.write(vmdef_json)
|
||||
fh.close()
|
||||
with open(fname, 'w') as fh:
|
||||
fh.write(vmdef_json)
|
||||
except Exception as e:
|
||||
module.fail_json(msg='Could not save JSON payload: %s' % to_native(e), exception=traceback.format_exc())
|
||||
|
||||
return fname
|
||||
|
||||
|
||||
def vm_state_transition(module, uuid, vm_state):
|
||||
ret = set_vm_state(module, uuid, vm_state)
|
||||
|
||||
|
@ -641,7 +641,7 @@ def main():
|
|||
cpu_type=dict(
|
||||
default='qemu64',
|
||||
type='str',
|
||||
choices=['host','qemu64']
|
||||
choices=['host', 'qemu64']
|
||||
),
|
||||
# Regular strings, however these require additional options.
|
||||
spice_password=dict(type='str', no_log=True),
|
||||
|
|
|
@ -162,7 +162,6 @@ lib/ansible/modules/cloud/rackspace/rax_mon_check.py
|
|||
lib/ansible/modules/cloud/rackspace/rax_mon_entity.py
|
||||
lib/ansible/modules/cloud/rackspace/rax_mon_notification.py
|
||||
lib/ansible/modules/cloud/rackspace/rax_mon_notification_plan.py
|
||||
lib/ansible/modules/cloud/smartos/vmadm.py
|
||||
lib/ansible/modules/cloud/softlayer/sl_vm.py
|
||||
lib/ansible/modules/cloud/univention/udm_dns_record.py
|
||||
lib/ansible/modules/cloud/univention/udm_dns_zone.py
|
||||
|
|
Loading…
Reference in a new issue