Bulk autopep8 (modules)

As agreed in 2017-12-07 Core meeting bulk fix pep8 issues

Generated using:
autopep8 1.3.3 (pycodestyle: 2.3.1)
autopep8 -r  --max-line-length 160 --in-place --ignore E305,E402,E722,E741 lib/ansible/modules

Manually fix issues that autopep8 has introduced
This commit is contained in:
John Barker 2017-12-07 16:27:06 +00:00 committed by John R Barker
commit c57a7f05e1
314 changed files with 3462 additions and 3383 deletions

View file

@ -231,7 +231,7 @@ def which_cmdfile():
'/etc/icinga/icinga.cfg',
# icinga installed from source (default location)
'/usr/local/icinga/etc/icinga.cfg',
]
]
for path in locations:
if os.path.exists(path):
@ -257,8 +257,7 @@ def main():
'command',
'servicegroup_host_downtime',
'servicegroup_service_downtime',
]
]
module = AnsibleModule(
argument_spec=dict(
@ -271,8 +270,8 @@ def main():
cmdfile=dict(default=which_cmdfile()),
services=dict(default=None, aliases=['service']),
command=dict(required=False, default=None),
)
)
)
action = module.params['action']
host = module.params['host']
@ -595,7 +594,6 @@ class Nagios(object):
dt_del_cmd_str = self._fmt_dt_del_str(cmd, host, svc=service, comment=comment)
self._write_command(dt_del_cmd_str)
def schedule_hostgroup_host_downtime(self, hostgroup, minutes=30):
"""
This command is used to schedule downtime for all hosts in a
@ -934,7 +932,7 @@ class Nagios(object):
cmd = [
"DISABLE_HOST_SVC_NOTIFICATIONS",
"DISABLE_HOST_NOTIFICATIONS"
]
]
nagios_return = True
return_str_list = []
for c in cmd:
@ -962,7 +960,7 @@ class Nagios(object):
cmd = [
"ENABLE_HOST_SVC_NOTIFICATIONS",
"ENABLE_HOST_NOTIFICATIONS"
]
]
nagios_return = True
return_str_list = []
for c in cmd:
@ -1027,19 +1025,19 @@ class Nagios(object):
minutes=self.minutes)
elif self.action == 'delete_downtime':
if self.services=='host':
if self.services == 'host':
self.delete_host_downtime(self.host)
elif self.services=='all':
elif self.services == 'all':
self.delete_host_downtime(self.host, comment='')
else:
self.delete_host_downtime(self.host, services=self.services)
elif self.action == "servicegroup_host_downtime":
if self.servicegroup:
self.schedule_servicegroup_host_downtime(servicegroup = self.servicegroup, minutes = self.minutes)
self.schedule_servicegroup_host_downtime(servicegroup=self.servicegroup, minutes=self.minutes)
elif self.action == "servicegroup_service_downtime":
if self.servicegroup:
self.schedule_servicegroup_svc_downtime(servicegroup = self.servicegroup, minutes = self.minutes)
self.schedule_servicegroup_svc_downtime(servicegroup=self.servicegroup, minutes=self.minutes)
# toggle the host AND service alerts
elif self.action == 'silence':
@ -1077,7 +1075,7 @@ class Nagios(object):
# wtf?
else:
self.module.fail_json(msg="unknown action specified: '%s'" % \
self.module.fail_json(msg="unknown action specified: '%s'" %
self.action)
self.module.exit_json(nagios_commands=self.command_results,