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

@ -137,7 +137,7 @@ def admin_set(xapi, module, admin_username, admin_password, role):
element='<%s>%s</%s>' % (role, rbval, role))
if admin_password is not None:
xapi.edit(xpath=_ADMIN_XPATH % admin_username+'/phash',
xapi.edit(xpath=_ADMIN_XPATH % admin_username + '/phash',
element='<phash>%s</phash>' % phash)
changed = True

View file

@ -84,9 +84,9 @@ import sys
try:
import paramiko
HAS_LIB=True
HAS_LIB = True
except ImportError:
HAS_LIB=False
HAS_LIB = False
_PROMPTBUFF = 4096
@ -101,7 +101,7 @@ def wait_with_timeout(module, shell, prompt, timeout=60):
if len(endresult) != 0 and endresult[-1] == prompt:
break
if time.time()-now > timeout:
if time.time() - now > timeout:
module.fail_json(msg="Timeout waiting for prompt")
return result
@ -143,14 +143,14 @@ def set_panwfw_password(module, ip_address, key_filename, newpassword, username)
stdout += buff
# enter password for the first time
shell.send(newpassword+'\n')
shell.send(newpassword + '\n')
# wait for the password prompt
buff = wait_with_timeout(module, shell, ":")
stdout += buff
# enter password for the second time
shell.send(newpassword+'\n')
shell.send(newpassword + '\n')
# wait for the config mode prompt
buff = wait_with_timeout(module, shell, "#")

View file

@ -81,7 +81,7 @@ EXAMPLES = '''
signed_by: "root-ca"
'''
RETURN='''
RETURN = '''
# Default return values
'''
@ -96,9 +96,9 @@ import time
try:
import paramiko
HAS_LIB=True
HAS_LIB = True
except ImportError:
HAS_LIB=False
HAS_LIB = False
_PROMPTBUFF = 4096
@ -113,14 +113,14 @@ def wait_with_timeout(module, shell, prompt, timeout=60):
if len(endresult) != 0 and endresult[-1] == prompt:
break
if time.time()-now > timeout:
if time.time() - now > timeout:
module.fail_json(msg="Timeout waiting for prompt")
return result
def generate_cert(module, ip_address, key_filename, password,
cert_cn, cert_friendly_name, signed_by, rsa_nbits ):
cert_cn, cert_friendly_name, signed_by, rsa_nbits):
stdout = ""
client = paramiko.SSHClient()
@ -154,7 +154,7 @@ def generate_cert(module, ip_address, key_filename, password,
shell.send('exit\n')
if 'Success' not in buff:
module.fail_json(msg="Error generating self signed certificate: "+stdout)
module.fail_json(msg="Error generating self signed certificate: " + stdout)
client.close()
return stdout

View file

@ -75,7 +75,7 @@ EXAMPLES = '''
delay: 30
'''
RETURN='''
RETURN = '''
# Default return values
'''
@ -131,7 +131,7 @@ def main():
timeout=60
)
checkpnt = time.time()+timeout
checkpnt = time.time() + timeout
while True:
try:
xapi.op(cmd="show jobs all", cmd_xml=True)

View file

@ -71,7 +71,7 @@ EXAMPLES = '''
dag_filter: "'aws-tag.aws:cloudformation:logical-id.ServerInstance' and 'instanceState.running'"
'''
RETURN='''
RETURN = '''
# Default return values
'''

View file

@ -73,7 +73,7 @@ EXAMPLES = '''
category: software
'''
RETURN='''
RETURN = '''
# Default return values
'''
@ -118,7 +118,7 @@ def import_file(xapi, module, ip_address, file_, category):
)
r = requests.post(
'https://'+ip_address+'/api/',
'https://' + ip_address + '/api/',
verify=False,
params=params,
headers={'Content-Type': mef.content_type},

View file

@ -78,7 +78,7 @@ EXAMPLES = '''
create_default_route: "yes"
'''
RETURN='''
RETURN = '''
# Default return values
'''
@ -98,8 +98,8 @@ _IF_XPATH = "/config/devices/entry[@name='localhost.localdomain']" +\
_ZONE_XPATH = "/config/devices/entry[@name='localhost.localdomain']" +\
"/vsys/entry/zone/entry"
_ZONE_XPATH_QUERY = _ZONE_XPATH+"[network/layer3/member/text()='%s']"
_ZONE_XPATH_IF = _ZONE_XPATH+"[@name='%s']/network/layer3/member[text()='%s']"
_ZONE_XPATH_QUERY = _ZONE_XPATH + "[network/layer3/member/text()='%s']"
_ZONE_XPATH_IF = _ZONE_XPATH + "[@name='%s']/network/layer3/member[text()='%s']"
_VR_XPATH = "/config/devices/entry[@name='localhost.localdomain']" +\
"/network/virtual-router/entry"
@ -120,9 +120,9 @@ def add_dhcp_if(xapi, if_name, zone_name, create_default_route):
if_xml = (''.join(if_xml)) % (if_name, cdr)
xapi.edit(xpath=_IF_XPATH % if_name, element=if_xml)
xapi.set(xpath=_ZONE_XPATH+"[@name='%s']/network/layer3" % zone_name,
xapi.set(xpath=_ZONE_XPATH + "[@name='%s']/network/layer3" % zone_name,
element='<member>%s</member>' % if_name)
xapi.set(xpath=_VR_XPATH+"[@name='default']/interface",
xapi.set(xpath=_VR_XPATH + "[@name='default']/interface",
element='<member>%s</member>' % if_name)
return True

View file

@ -71,7 +71,7 @@ EXAMPLES = '''
file: "{{result.filename}}"
'''
RETURN='''
RETURN = '''
# Default return values
'''

View file

@ -81,7 +81,7 @@ EXAMPLES = '''
panorama_secondary: "1.1.1.4"
'''
RETURN='''
RETURN = '''
# Default return values
'''
@ -112,11 +112,11 @@ def set_dns_server(xapi, new_dns_server, primary=True):
tag = "primary"
else:
tag = "secondary"
xpath = _XPATH_DNS_SERVERS+"/"+tag
xpath = _XPATH_DNS_SERVERS + "/" + tag
# check the current element value
xapi.get(xpath)
val = xapi.element_root.find(".//"+tag)
val = xapi.element_root.find(".//" + tag)
if val is not None:
# element exists
val = val.text
@ -135,11 +135,11 @@ def set_panorama_server(xapi, new_panorama_server, primary=True):
tag = "panorama-server"
else:
tag = "panorama-server-2"
xpath = _XPATH_PANORAMA_SERVERS+"/"+tag
xpath = _XPATH_PANORAMA_SERVERS + "/" + tag
# check the current element value
xapi.get(xpath)
val = xapi.element_root.find(".//"+tag)
val = xapi.element_root.find(".//" + tag)
if val is not None:
# element exists
val = val.text

View file

@ -101,7 +101,7 @@ EXAMPLES = '''
vulnerability: "default"
'''
RETURN='''
RETURN = '''
# Default return values
'''