mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Introspect flag to use on 'show run' when using defaults in ios_config (#22903)
When the ios_config module has 'defaults' param it runs in the device the command 'show running-config all' but 'all' may not be available in older devices. This change makes introspection by using the help command and run 'full' in case 'all' is not available. Fixes #22747
This commit is contained in:
parent
495a1340a6
commit
a5b12ff269
2 changed files with 12 additions and 1 deletions
|
@ -206,6 +206,7 @@ import re
|
|||
import time
|
||||
|
||||
from ansible.module_utils.ios import run_commands, get_config, load_config
|
||||
from ansible.module_utils.ios import get_defaults_flag
|
||||
from ansible.module_utils.ios import ios_argument_spec
|
||||
from ansible.module_utils.ios import check_args as ios_check_args
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
@ -266,7 +267,7 @@ def get_running_config(module):
|
|||
if not contents:
|
||||
flags = []
|
||||
if module.params['defaults']:
|
||||
flags.append('all')
|
||||
flags.append(get_defaults_flag(module))
|
||||
contents = get_config(module, flags=flags)
|
||||
contents, banners = extract_banners(contents)
|
||||
return NetworkConfig(indent=1, contents=contents), banners
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue