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>pull/4420/head
parent
8987a647e3
commit
991a9dfa12
|
@ -122,6 +122,13 @@ options:
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
version_added: "2.4"
|
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:
|
requirements:
|
||||||
- ncclient (>=v0.5.2)
|
- ncclient (>=v0.5.2)
|
||||||
notes:
|
notes:
|
||||||
|
@ -157,6 +164,10 @@ EXAMPLES = """
|
||||||
- set interfaces irb unit 10 family inet address 10.0.0.1/24
|
- set interfaces irb unit 10 family inet address 10.0.0.1/24
|
||||||
- set vlans vlan01 l3-interface irb.10
|
- 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
|
- name: rollback the configuration to id 10
|
||||||
junos_config:
|
junos_config:
|
||||||
rollback: 10
|
rollback: 10
|
||||||
|
@ -313,6 +324,7 @@ def main():
|
||||||
confirm=dict(default=0, type='int'),
|
confirm=dict(default=0, type='int'),
|
||||||
comment=dict(default=DEFAULT_COMMENT),
|
comment=dict(default=DEFAULT_COMMENT),
|
||||||
confirm_commit=dict(type='bool', default=False),
|
confirm_commit=dict(type='bool', default=False),
|
||||||
|
check_commit=dict(type='bool', default=False),
|
||||||
|
|
||||||
# config operations
|
# config operations
|
||||||
backup=dict(type='bool', default=False),
|
backup=dict(type='bool', default=False),
|
||||||
|
@ -391,6 +403,9 @@ def main():
|
||||||
if module._diff:
|
if module._diff:
|
||||||
result['diff'] = {'prepared': diff}
|
result['diff'] = {'prepared': diff}
|
||||||
|
|
||||||
|
elif module.params['check_commit']:
|
||||||
|
commit_configuration(module, check=True)
|
||||||
|
|
||||||
elif module.params['confirm_commit']:
|
elif module.params['confirm_commit']:
|
||||||
with locked_config(module):
|
with locked_config(module):
|
||||||
# confirm a previous commit
|
# confirm a previous commit
|
||||||
|
|
Loading…
Reference in New Issue