mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Junos fixes (#22423)
* Fixes for junos_config errors * Check transport settings for core Junos * Don't pop from the same list you iterate over * use of persistent connections are now explicitly enabled in junos * modules must now explicitly enable persistent connections * adds rpc support to junos_command fixes #22166
This commit is contained in:
parent
17fc6832ca
commit
1825406e1e
7 changed files with 207 additions and 86 deletions
|
@ -82,6 +82,14 @@ from ansible.module_utils.junos import junos_argument_spec, check_args
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
USE_PERSISTENT_CONNECTION = True
|
||||
|
||||
def check_transport(module):
|
||||
transport = (module.params['provider'] or {}).get('transport')
|
||||
|
||||
if transport == 'netconf':
|
||||
module.fail_json(msg='junos_netconf module is only supported over cli transport')
|
||||
|
||||
|
||||
def map_obj_to_commands(updates, module):
|
||||
want, have = updates
|
||||
|
@ -145,10 +153,13 @@ def main():
|
|||
)
|
||||
|
||||
argument_spec.update(junos_argument_spec)
|
||||
argument_spec['transport'] = dict(choices=['cli'], default='cli')
|
||||
|
||||
module = AnsibleModule(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
check_transport(module)
|
||||
|
||||
warnings = list()
|
||||
check_args(module, warnings)
|
||||
|
||||
|
@ -163,7 +174,7 @@ def main():
|
|||
if commands:
|
||||
commit = not module.check_mode
|
||||
diff = load_config(module, commands, commit=commit)
|
||||
if diff and module._diff:
|
||||
if diff:
|
||||
if module._diff:
|
||||
result['diff'] = {'prepared': diff}
|
||||
result['changed'] = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue