mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
adds new option to get_config to grab config with passwords (#17915)
In order for the config to be returned with vpn passwords, the get_config() method now supports a keyword arg include=passwords to return the desired configuration. This replaces the show_command argument
This commit is contained in:
parent
0afc327532
commit
087fb4265f
2 changed files with 9 additions and 17 deletions
|
@ -35,8 +35,6 @@ from ansible.module_utils.network import to_list
|
|||
from ansible.module_utils.shell import CliBase
|
||||
from ansible.module_utils.netcli import Command
|
||||
|
||||
add_argument('show_command', dict(default='show running-config',
|
||||
choices=['show running-config', 'more system:running-config']))
|
||||
add_argument('context', dict(required=False))
|
||||
|
||||
|
||||
|
@ -88,10 +86,16 @@ class Cli(CliBase):
|
|||
responses = self.execute(cmds)
|
||||
return responses[1:]
|
||||
|
||||
def get_config(self, include_defaults=False):
|
||||
def get_config(self, include=None):
|
||||
if include not in [None, 'defaults', 'passwords']:
|
||||
raise ValueError('include must be one of None, defaults, passwords')
|
||||
cmd = 'show running-config'
|
||||
if include_defaults:
|
||||
cmd += ' all'
|
||||
if include == 'passwords':
|
||||
cmd = 'more system:running-config'
|
||||
elif include_defaults:
|
||||
cmd = 'show running-config all'
|
||||
else:
|
||||
cmd = 'show running-config'
|
||||
return self.run_commands(cmd)[0]
|
||||
|
||||
def load_config(self, commands):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue