Merge pull request #3050 from sivel/module-cleanup

Various simple linting type cleanups on modules
This commit is contained in:
Matt Martz 2016-02-16 16:03:34 -06:00
commit 4e594a9196
11 changed files with 8 additions and 14 deletions

View file

@ -243,7 +243,6 @@ def create_image(module, ec2):
for img in images: for img in images:
if img.name == name: if img.name == name:
module.exit_json(msg="AMI name already present", image_id=img.id, state=img.state, changed=False) module.exit_json(msg="AMI name already present", image_id=img.id, state=img.state, changed=False)
sys.exit(0)
else: else:
module.fail_json(msg="Error in retrieving duplicate AMI details") module.fail_json(msg="Error in retrieving duplicate AMI details")
else: else:
@ -321,7 +320,6 @@ def deregister_image(module, ec2):
module.fail_json(msg = "timed out waiting for image to be reregistered/deleted") module.fail_json(msg = "timed out waiting for image to be reregistered/deleted")
module.exit_json(msg="AMI deregister/delete operation complete", changed=True) module.exit_json(msg="AMI deregister/delete operation complete", changed=True)
sys.exit(0)
def update_image(module, ec2): def update_image(module, ec2):

View file

@ -175,7 +175,6 @@ def main():
if state == 'list': if state == 'list':
module.exit_json(changed=False, tags=tagdict) module.exit_json(changed=False, tags=tagdict)
sys.exit(0)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *

View file

@ -415,7 +415,7 @@ def modify_dot_attribute(module, ec2, instance, device_name):
ec2.modify_instance_attribute(instance_id=instance.id, attribute='blockDeviceMapping', value=bdm) ec2.modify_instance_attribute(instance_id=instance.id, attribute='blockDeviceMapping', value=bdm)
while instance.block_device_mapping[device_name].delete_on_termination != delete_on_termination: while instance.block_device_mapping[device_name].delete_on_termination != delete_on_termination:
time.sleep(3) time.sleep(3)
instance.update() instance.update()
changed = True changed = True

View file

@ -520,7 +520,6 @@ def main():
# Use this snippet to debug through conditionals: # Use this snippet to debug through conditionals:
# module.exit_json(msg="Bucket return %s"%bucketrtn) # module.exit_json(msg="Bucket return %s"%bucketrtn)
# sys.exit(0)
# Lets check the src path. # Lets check the src path.
pathrtn = path_check(src) pathrtn = path_check(src)

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# This file is part of Ansible # This file is part of Ansible

View file

@ -146,7 +146,7 @@ def main():
if mysqlvar is None: if mysqlvar is None:
module.fail_json(msg="Cannot run without variable to operate with") module.fail_json(msg="Cannot run without variable to operate with")
if match('^[0-9a-z_]+$', mysqlvar) is None: if match('^[0-9a-z_]+$', mysqlvar) is None:
module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar) module.fail_json(msg="invalid variable name \"%s\"" % mysqlvar)
if not mysqldb_found: if not mysqldb_found:
module.fail_json(msg="the python mysqldb module is required") module.fail_json(msg="the python mysqldb module is required")
else: else:

View file

@ -274,7 +274,6 @@ def main():
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.shell import * from ansible.module_utils.shell import *
from ansible.module_utils.eos import * from ansible.module_utils.eos import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -380,7 +380,6 @@ def main():
module.exit_json(changed=changed, **args) module.exit_json(changed=changed, **args)
module.fail_json(msg='Unexpected position reached') module.fail_json(msg='Unexpected position reached')
sys.exit(0)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *

View file

@ -1172,7 +1172,7 @@ class NetBsdService(Service):
distribution = None distribution = None
def get_service_tools(self): def get_service_tools(self):
initpaths = [ '/etc/rc.d' ] # better: $rc_directories - how to get in here? Run: sh -c '. /etc/rc.conf ; echo $rc_directories' initpaths = [ '/etc/rc.d' ] # better: $rc_directories - how to get in here? Run: sh -c '. /etc/rc.conf ; echo $rc_directories'
for initdir in initpaths: for initdir in initpaths:
initscript = "%s/%s" % (initdir,self.name) initscript = "%s/%s" % (initdir,self.name)
@ -1188,7 +1188,7 @@ class NetBsdService(Service):
else: else:
self.rcconf_value = "NO" self.rcconf_value = "NO"
rcfiles = [ '/etc/rc.conf' ] # Overkill? rcfiles = [ '/etc/rc.conf' ] # Overkill?
for rcfile in rcfiles: for rcfile in rcfiles:
if os.path.isfile(rcfile): if os.path.isfile(rcfile):
self.rcconf_file = rcfile self.rcconf_file = rcfile

View file

@ -356,7 +356,6 @@ def main():
result = SysctlModule(module) result = SysctlModule(module)
module.exit_json(changed=result.changed) module.exit_json(changed=result.changed)
sys.exit(0)
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *

View file

@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# WANT_JSON
# POWERSHELL_COMMON # POWERSHELL_COMMON
######## ########