mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00: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:
@@ -116,8 +116,16 @@ from ansible.module_utils.junos import check_args, junos_argument_spec
|
||||
from ansible.module_utils.junos import get_configuration, load
|
||||
from ansible.module_utils.six import text_type
|
||||
|
||||
USE_PERSISTENT_CONNECTION = True
|
||||
DEFAULT_COMMENT = 'configured by junos_template'
|
||||
|
||||
def check_transport(module):
|
||||
transport = (module.params['provider'] or {}).get('transport')
|
||||
|
||||
if transport == 'netconf':
|
||||
module.fail_json(msg='junos_template module is only supported over cli transport')
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
argument_spec = dict(
|
||||
@@ -127,7 +135,6 @@ def main():
|
||||
action=dict(default='merge', choices=['merge', 'overwrite', 'replace']),
|
||||
config_format=dict(choices=['text', 'set', 'xml']),
|
||||
backup=dict(default=False, type='bool'),
|
||||
transport=dict(default='netconf', choices=['netconf'])
|
||||
)
|
||||
|
||||
argument_spec.update(junos_argument_spec)
|
||||
@@ -135,6 +142,8 @@ def main():
|
||||
module = AnsibleModule(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
check_transport(module)
|
||||
|
||||
warnings = list()
|
||||
check_args(module, warnings)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user