PR to support commit check to confirm commits with JunOS (#49054)

* commit check support

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* fixed review comments

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* fixed review comments

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* fixed shippable

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
This commit is contained in:
Sumit Jaiswal 2018-11-28 11:27:46 +05:30 committed by GitHub
parent 8987a647e3
commit 991a9dfa12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,6 +122,13 @@ options:
type: bool
default: 'no'
version_added: "2.4"
check_commit:
description:
- This argument will check correctness of syntax; do not apply changes.
- Note that this argument can be used to confirm verified configuration done via commit confirmed operation
type: bool
default: 'no'
version_added: "2.8"
requirements:
- ncclient (>=v0.5.2)
notes:
@ -157,6 +164,10 @@ EXAMPLES = """
- set interfaces irb unit 10 family inet address 10.0.0.1/24
- set vlans vlan01 l3-interface irb.10
- name: Check correctness of commit configuration
junos_config:
check_commit: yes
- name: rollback the configuration to id 10
junos_config:
rollback: 10
@ -313,6 +324,7 @@ def main():
confirm=dict(default=0, type='int'),
comment=dict(default=DEFAULT_COMMENT),
confirm_commit=dict(type='bool', default=False),
check_commit=dict(type='bool', default=False),
# config operations
backup=dict(type='bool', default=False),
@ -391,6 +403,9 @@ def main():
if module._diff:
result['diff'] = {'prepared': diff}
elif module.params['check_commit']:
commit_configuration(module, check=True)
elif module.params['confirm_commit']:
with locked_config(module):
# confirm a previous commit