mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
[CLI_CONF] Refactor nxos module common library to use cliconf plugin (#31524)
* refactor nxos modules Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * get_config update * fix get_config * update nxos module * device_info * fix conflict * add failure message check * pep8 fixes * use get_capabilities to check cliconf * Add logic to detect platform in get_capabilities and cache in module_utils * return msg in edit_config * fix conflicts * make modules compatible * fix nxos cliconf api Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * cache capabilities * Update transport queries to get_capabilities in module level * fix unit tests * load_config error code * remove unnecessary change * Refactor nxos_install_os module
This commit is contained in:
parent
bd399ec674
commit
9f86b923e9
23 changed files with 220 additions and 132 deletions
|
@ -126,18 +126,17 @@ import re
|
|||
|
||||
from ansible.module_utils.network.nxos.nxos import run_commands, load_config
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
|
||||
from ansible.module_utils.network.nxos.nxos import check_args as nxos_check_args
|
||||
from ansible.module_utils.network.nxos.nxos import get_capabilities
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
|
||||
def check_args(module, warnings):
|
||||
provider = module.params['provider']
|
||||
if provider['transport'] == 'nxapi':
|
||||
device_info = get_capabilities(module)
|
||||
network_api = device_info.get('network_api', 'nxapi')
|
||||
if network_api == 'nxapi':
|
||||
module.fail_json(msg='module not supported over nxapi transport')
|
||||
|
||||
nxos_check_args(module, warnings)
|
||||
|
||||
state = module.params['state']
|
||||
|
||||
if state == 'started':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue