mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Adding aireos_config module (#27408)
* Adding aireos_config module. * Fixing pep8 W291.
This commit is contained in:
committed by
Ganesh Nalawade
parent
d10719b252
commit
a328e96455
@@ -48,6 +48,15 @@ ARGS_DEFAULT_VALUE = {
|
||||
}
|
||||
|
||||
|
||||
def sanitize(resp):
|
||||
# Takes config from device and strips whitespace from all lines
|
||||
# Aireos adds in extra preceding whitespace which netcfg parses as children/parents, which Aireos does not do
|
||||
cleaned = []
|
||||
for line in resp.splitlines():
|
||||
cleaned.append(line.strip())
|
||||
return '\n'.join(cleaned).strip()
|
||||
|
||||
|
||||
def get_argspec():
|
||||
return aireos_argument_spec
|
||||
|
||||
@@ -82,7 +91,7 @@ def get_config(module, flags=[]):
|
||||
rc, out, err = exec_command(module, cmd)
|
||||
if rc != 0:
|
||||
module.fail_json(msg='unable to retrieve current config', stderr=to_text(err, errors='surrogate_then_replace'))
|
||||
cfg = to_text(out, errors='surrogate_then_replace').strip()
|
||||
cfg = sanitize(to_text(out, errors='surrogate_then_replace').strip())
|
||||
_DEVICE_CONFIGS[cmd] = cfg
|
||||
return cfg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user