mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
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:
parent
d13d7e9404
commit
c57a7f05e1
314 changed files with 3462 additions and 3383 deletions
|
@ -130,6 +130,7 @@ from ansible.module_utils.network.nxos.nxos import check_args as nxos_check_args
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
|
||||
def check_args(module, warnings):
|
||||
provider = module.params['provider']
|
||||
if provider['transport'] == 'nxapi':
|
||||
|
@ -159,10 +160,11 @@ def check_args(module, warnings):
|
|||
|
||||
return warnings
|
||||
|
||||
|
||||
def map_obj_to_commands(want, have, module):
|
||||
commands = list()
|
||||
|
||||
needs_update = lambda x: want.get(x) is not None and (want.get(x) != have.get(x))
|
||||
def needs_update(x): return want.get(x) is not None and (want.get(x) != have.get(x))
|
||||
|
||||
if needs_update('state'):
|
||||
if want['state'] == 'absent':
|
||||
|
@ -191,6 +193,7 @@ def map_obj_to_commands(want, have, module):
|
|||
|
||||
return commands
|
||||
|
||||
|
||||
def parse_http(data):
|
||||
http_res = [r'nxapi http port (\d+)']
|
||||
http_port = None
|
||||
|
@ -203,6 +206,7 @@ def parse_http(data):
|
|||
|
||||
return {'http': http_port is not None, 'http_port': http_port}
|
||||
|
||||
|
||||
def parse_https(data):
|
||||
https_res = [r'nxapi https port (\d+)']
|
||||
https_port = None
|
||||
|
@ -215,6 +219,7 @@ def parse_https(data):
|
|||
|
||||
return {'https': https_port is not None, 'https_port': https_port}
|
||||
|
||||
|
||||
def parse_sandbox(data):
|
||||
sandbox = [item for item in data.split('\n') if re.search(r'.*sandbox.*', item)]
|
||||
value = False
|
||||
|
@ -222,6 +227,7 @@ def parse_sandbox(data):
|
|||
value = True
|
||||
return {'sandbox': value}
|
||||
|
||||
|
||||
def map_config_to_obj(module):
|
||||
out = run_commands(module, ['show run all | inc nxapi'], check_rc=False)[0]
|
||||
match = re.search(r'no feature nxapi', out, re.M)
|
||||
|
@ -240,6 +246,7 @@ def map_config_to_obj(module):
|
|||
|
||||
return obj
|
||||
|
||||
|
||||
def map_params_to_obj(module):
|
||||
obj = {
|
||||
'http': module.params['http'],
|
||||
|
@ -252,6 +259,7 @@ def map_params_to_obj(module):
|
|||
|
||||
return obj
|
||||
|
||||
|
||||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
|
@ -275,8 +283,6 @@ def main():
|
|||
module = AnsibleModule(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
|
||||
|
||||
warnings = list()
|
||||
check_args(module, warnings)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue