|
|
@ -104,7 +104,13 @@ def get_defaults_flag(module):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_config(module, flags=None):
|
|
|
|
def get_config(module, flags=None):
|
|
|
|
flag_str = ' '.join(to_list(flags))
|
|
|
|
flags = to_list(flags)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
section_filter = False
|
|
|
|
|
|
|
|
if flags and 'section' in flags[-1]:
|
|
|
|
|
|
|
|
section_filter = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flag_str = ' '.join(flags)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
return _DEVICE_CONFIGS[flag_str]
|
|
|
|
return _DEVICE_CONFIGS[flag_str]
|
|
|
@ -113,6 +119,10 @@ def get_config(module, flags=None):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
out = connection.get_config(flags=flags)
|
|
|
|
out = connection.get_config(flags=flags)
|
|
|
|
except ConnectionError as exc:
|
|
|
|
except ConnectionError as exc:
|
|
|
|
|
|
|
|
if section_filter:
|
|
|
|
|
|
|
|
# Some ios devices don't understand `| section foo`
|
|
|
|
|
|
|
|
out = get_config(module, flags=flags[:-1])
|
|
|
|
|
|
|
|
else:
|
|
|
|
module.fail_json(msg=to_text(exc, errors='surrogate_then_replace'))
|
|
|
|
module.fail_json(msg=to_text(exc, errors='surrogate_then_replace'))
|
|
|
|
cfg = to_text(out, errors='surrogate_then_replace').strip()
|
|
|
|
cfg = to_text(out, errors='surrogate_then_replace').strip()
|
|
|
|
_DEVICE_CONFIGS[flag_str] = cfg
|
|
|
|
_DEVICE_CONFIGS[flag_str] = cfg
|
|
|
|