mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 21:01:27 -07:00
Standardize cliconf get_capabilities (#51147)
* Standardize cliconf get_capabilities * Check for capabilities before querying them * Try to be more helpful when unexpected things are found in get_capabilities * Add flags param to get_config for compatibility
This commit is contained in:
parent
bd44db141a
commit
9336281a60
26 changed files with 82 additions and 143 deletions
|
@ -52,7 +52,7 @@ class Cliconf(CliconfBase):
|
|||
return device_info
|
||||
|
||||
@enable_mode
|
||||
def get_config(self, source='running', format='text'):
|
||||
def get_config(self, source='running', format='text', flags=None):
|
||||
if source not in ('running', 'startup'):
|
||||
msg = "fetching configuration from %s is not supported"
|
||||
return self.invalid_params(msg % source)
|
||||
|
@ -71,8 +71,5 @@ class Cliconf(CliconfBase):
|
|||
return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, check_all=check_all)
|
||||
|
||||
def get_capabilities(self):
|
||||
result = {}
|
||||
result['rpc'] = self.get_base_rpc()
|
||||
result['network_api'] = 'cliconf'
|
||||
result['device_info'] = self.get_device_info()
|
||||
result = super(Cliconf, self).get_capabilities()
|
||||
return json.dumps(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue