junos_linkagg implementation and junos modules refactor (#26587)

* junos_linkagg implementation and junos modules refactor

*  junos_linkagg implementation
*  junos_linkagg integration test
*  net_linkagg integration test for junos
*  decouple `load_config` and `commit` operations,
   to allow single commit (in case on confirm commit) and
   to perform batch commit (multiple `load_config` followed by single
   `commit`)
*  Other related refactor

* Fix CI issues

* Fix unit test failure
This commit is contained in:
Ganesh Nalawade 2017-07-11 09:52:53 +05:30 committed by GitHub
commit be89ef3eb6
30 changed files with 1140 additions and 220 deletions

View file

@ -76,9 +76,10 @@ commands:
"""
import re
from ansible.module_utils.junos import junos_argument_spec, check_args
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import exec_command
from ansible.module_utils.junos import junos_argument_spec, check_args
from ansible.module_utils.junos import commit_configuration, discard_changes
from ansible.module_utils.network_common import to_list
from ansible.module_utils.six import iteritems
@ -195,11 +196,16 @@ def main():
if commands:
commit = not module.check_mode
diff = load_config(module, commands, commit=commit)
diff = load_config(module, commands)
if diff:
if commit:
commit_configuration(module)
else:
discard_changes(module)
result['changed'] = True
if module._diff:
result['diff'] = {'prepared': diff}
result['changed'] = True
module.exit_json(**result)