mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
restore the ability to issue commands over junos cli (#28025)
* restore the ability to issue commands over junos cli * add warn message for invalid arguments * fix issue when checking if provider transport is set
This commit is contained in:
parent
5fbbf0e75a
commit
edc3507c98
2 changed files with 16 additions and 1 deletions
|
@ -174,6 +174,7 @@ from ansible.module_utils.junos import junos_argument_spec, check_args, get_conf
|
|||
from ansible.module_utils.netcli import Conditional, FailedConditionalError
|
||||
from ansible.module_utils.netconf import send_request
|
||||
from ansible.module_utils.six import string_types, iteritems
|
||||
from ansible.module_utils.connection import Connection
|
||||
|
||||
try:
|
||||
from lxml.etree import Element, SubElement, tostring
|
||||
|
@ -364,6 +365,18 @@ def main():
|
|||
warnings = list()
|
||||
check_args(module, warnings)
|
||||
|
||||
if module.params['provider'] and module.params['provider']['transport'] == 'cli':
|
||||
if any((module.params['wait_for'], module.params['match'], module.params['rpcs'])):
|
||||
module.warn('arguments wait_for, match, rpcs are not supported when using transport=cli')
|
||||
commands = module.params['commands']
|
||||
conn = Connection(module)
|
||||
output = list()
|
||||
for cmd in commands:
|
||||
output.append(conn.get(cmd))
|
||||
lines = [out.split('\n') for out in output]
|
||||
result = {'changed': False, 'stdout': output, 'stdout_lines': lines}
|
||||
module.exit_json(**result)
|
||||
|
||||
items = list()
|
||||
items.extend(parse_commands(module, warnings))
|
||||
items.extend(parse_rpcs(module))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue