From 0dfd3f177fda3d6fbfffcebc4939744807f6e49a Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 2 Sep 2016 22:36:22 -0400 Subject: [PATCH] update junos_template module This updates the junos_template module implementing the changes for Ansible 2.2 --- network/junos/junos_template.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/network/junos/junos_template.py b/network/junos/junos_template.py index 8bbdbc19f81..2f8e64d5b5e 100644 --- a/network/junos/junos_template.py +++ b/network/junos/junos_template.py @@ -100,6 +100,7 @@ EXAMPLES = """ src: config.j2 action: overwrite """ +from ansible.module_utils.junos import NetworkModule DEFAULT_COMMENT = 'configured by junos_template' @@ -115,8 +116,8 @@ def main(): transport=dict(default='netconf', choices=['netconf']) ) - module = get_module(argument_spec=argument_spec, - supports_check_mode=True) + module = NetworkModule(argument_spec=argument_spec, + supports_check_mode=True) comment = module.params['comment'] confirm = module.params['confirm'] @@ -132,9 +133,9 @@ def main(): "set per junos documentation") results = dict(changed=False) - results['_backup'] = str(module.get_config()).strip() + results['_backup'] = str(module.config.get_config()).strip() - diff = module.load_config(src, action=action, comment=comment, + diff = module.config.load_config(src, action=action, comment=comment, format=fmt, commit=commit, confirm=confirm) if diff: @@ -144,8 +145,5 @@ def main(): module.exit_json(**results) -from ansible.module_utils.basic import * -from ansible.module_utils.junos import * - if __name__ == '__main__': main()