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
|
@ -206,6 +206,7 @@ def check_args(module, warnings):
|
|||
'match=none instead. This argument will be '
|
||||
'removed in the future')
|
||||
|
||||
|
||||
def extract_banners(config):
|
||||
banners = {}
|
||||
banner_cmds = re.findall(r'^banner (\w+)', config, re.M)
|
||||
|
@ -225,6 +226,7 @@ def extract_banners(config):
|
|||
config = re.sub(r'banner \w+ \^C\^C', '!! banner removed', config)
|
||||
return (config, banners)
|
||||
|
||||
|
||||
def diff_banners(want, have):
|
||||
candidate = {}
|
||||
for key, value in iteritems(want):
|
||||
|
@ -232,6 +234,7 @@ def diff_banners(want, have):
|
|||
candidate[key] = value
|
||||
return candidate
|
||||
|
||||
|
||||
def load_banners(module, banners):
|
||||
delimiter = module.params['multiline_delimiter']
|
||||
for key, value in iteritems(banners):
|
||||
|
@ -242,6 +245,7 @@ def load_banners(module, banners):
|
|||
time.sleep(1)
|
||||
module.connection.shell.receive()
|
||||
|
||||
|
||||
def get_config(module, result):
|
||||
contents = module.params['config']
|
||||
if not contents:
|
||||
|
@ -251,6 +255,7 @@ def get_config(module, result):
|
|||
contents, banners = extract_banners(contents)
|
||||
return NetworkConfig(indent=1, contents=contents), banners
|
||||
|
||||
|
||||
def get_candidate(module):
|
||||
candidate = NetworkConfig(indent=1)
|
||||
banners = {}
|
||||
|
@ -265,6 +270,7 @@ def get_candidate(module):
|
|||
|
||||
return candidate, banners
|
||||
|
||||
|
||||
def run(module, result):
|
||||
match = module.params['match']
|
||||
replace = module.params['replace']
|
||||
|
@ -275,7 +281,7 @@ def run(module, result):
|
|||
if match != 'none':
|
||||
config, have_banners = get_config(module, result)
|
||||
path = module.params['parents']
|
||||
configobjs = candidate.difference(config, path=path,match=match,
|
||||
configobjs = candidate.difference(config, path=path, match=match,
|
||||
replace=replace)
|
||||
else:
|
||||
configobjs = candidate.items
|
||||
|
@ -311,6 +317,7 @@ def run(module, result):
|
|||
module.config.save_config()
|
||||
result['changed'] = True
|
||||
|
||||
|
||||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
|
|
|
@ -223,6 +223,7 @@ FACT_SUBSETS = dict(
|
|||
|
||||
VALID_SUBSETS = frozenset(FACT_SUBSETS.keys())
|
||||
|
||||
|
||||
def main():
|
||||
spec = dict(
|
||||
gather_subset=dict(default=['!config'], type='list')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue