mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Update iosxr cliconf plugin (#43837)
* Update iosxr cliconf plugin Fixes #39056 * Update iosxr cliconf plugin * Modify iosxr module_utils code to support refactored cliconf plugin api's * Other minor changes * Fix unit test failure * Update ios, eos, nxos plugin for diff * Fix review comment
This commit is contained in:
@@ -122,7 +122,7 @@ failed_conditions:
|
||||
import time
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.iosxr.iosxr import run_command, iosxr_argument_spec
|
||||
from ansible.module_utils.network.iosxr.iosxr import run_commands, iosxr_argument_spec
|
||||
from ansible.module_utils.network.iosxr.iosxr import command_spec
|
||||
from ansible.module_utils.network.common.parsing import Conditional
|
||||
from ansible.module_utils.six import string_types
|
||||
@@ -188,7 +188,7 @@ def main():
|
||||
match = module.params['match']
|
||||
|
||||
while retries > 0:
|
||||
responses = run_command(module, commands)
|
||||
responses = run_commands(module, commands)
|
||||
|
||||
for item in list(conditionals):
|
||||
if item(responses):
|
||||
|
||||
@@ -366,6 +366,8 @@ def run(module, result):
|
||||
running_config = get_running_config(module)
|
||||
|
||||
commands = None
|
||||
replace_file_path = None
|
||||
|
||||
if match != 'none' and replace != 'config':
|
||||
commands = candidate_config.difference(running_config, path=path, match=match, replace=replace)
|
||||
elif replace_config:
|
||||
@@ -380,6 +382,7 @@ def run(module, result):
|
||||
module.fail_json(msg='Copy of config file to the node failed')
|
||||
|
||||
commands = ['load harddisk:/ansible_config.txt']
|
||||
replace_file_path = 'harddisk:/ansible_config.txt'
|
||||
else:
|
||||
commands = candidate_config.items
|
||||
|
||||
@@ -399,7 +402,7 @@ def run(module, result):
|
||||
commit = not check_mode
|
||||
diff = load_config(
|
||||
module, commands, commit=commit,
|
||||
replace=replace_config, comment=comment, admin=admin,
|
||||
replace=replace_file_path, comment=comment, admin=admin,
|
||||
label=label
|
||||
)
|
||||
if diff:
|
||||
|
||||
@@ -118,7 +118,7 @@ ansible_net_neighbors:
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.iosxr.iosxr import iosxr_argument_spec, run_command
|
||||
from ansible.module_utils.network.iosxr.iosxr import iosxr_argument_spec, run_commands
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.six.moves import zip
|
||||
|
||||
@@ -407,7 +407,7 @@ def main():
|
||||
try:
|
||||
for inst in instances:
|
||||
commands = inst.commands()
|
||||
responses = run_command(module, commands)
|
||||
responses = run_commands(module, commands)
|
||||
results = dict(zip(commands, responses))
|
||||
inst.populate(results)
|
||||
facts.update(inst.facts)
|
||||
|
||||
@@ -195,7 +195,7 @@ import collections
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.iosxr.iosxr import get_config, load_config, build_xml
|
||||
from ansible.module_utils.network.iosxr.iosxr import run_command, iosxr_argument_spec, get_oper
|
||||
from ansible.module_utils.network.iosxr.iosxr import run_commands, iosxr_argument_spec, get_oper
|
||||
from ansible.module_utils.network.iosxr.iosxr import is_netconf, is_cliconf, etree_findall, etree_find
|
||||
from ansible.module_utils.network.common.utils import conditional, remove_default_spec
|
||||
|
||||
@@ -382,7 +382,7 @@ class CliConfiguration(ConfigBase):
|
||||
sleep(want_item['delay'])
|
||||
|
||||
command = 'show interfaces {!s}'.format(want_item['name'])
|
||||
out = run_command(self._module, command)[0]
|
||||
out = run_commands(self._module, command)[0]
|
||||
|
||||
if want_state in ('up', 'down'):
|
||||
match = re.search(r'%s (\w+)' % 'line protocol is', out, re.M)
|
||||
|
||||
Reference in New Issue
Block a user