Skip to content

Commit

Permalink
Fix for the issue #607 (#665)
Browse files Browse the repository at this point in the history
* Fix for the issue #607

* Fix for the issue #607

* Fix for the issue #607

* Fix for the issue #607
  • Loading branch information
chidanandpujar committed May 17, 2024
1 parent 3670c21 commit ff81c02
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ansible_collections/juniper/device/plugins/connection/pyez.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ def commit_configuration(self, ignore_warning=None, comment=None,
Failures:
- An error returned from committing the configuration.
"""
if self.dev.timeout:
timeout = self.dev.timeout
try:
self.config.commit(ignore_warning=ignore_warning,
comment=comment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,10 @@ def commit_configuration(self, ignore_warning=None, comment=None,
Failures:
- An error returned from committing the configuration.
"""
if self.conn_type == "local":
if self.dev.timeout:
timeout = self.dev.timeout

if self.conn_type != "local":
self._pyez_conn.commit_configuration(ignore_warning=ignore_warning,
comment=comment,
Expand Down
5 changes: 5 additions & 0 deletions ansible_collections/juniper/device/plugins/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,9 @@ def main():
type='int',
aliases=['confirm'],
default=None),
timeout=dict(required=False,
type='int',
default=30),
comment=dict(required=False,
type='str',
default=None),
Expand Down Expand Up @@ -995,6 +998,7 @@ def main():
commit_sync = junos_module.params.get('commit_sync')
commit_force_sync = junos_module.params.get('commit_force_sync')
confirmed = junos_module.params.get('confirmed')
timeout = junos_module.params.get('timeout')
comment = junos_module.params.get('comment')
check_commit_wait = junos_module.params.get('check_commit_wait')
model = junos_module.params.get('model')
Expand Down Expand Up @@ -1227,6 +1231,7 @@ def main():
junos_module.commit_configuration(ignore_warning=ignore_warning,
comment=comment,
confirmed=confirmed,
timeout=timeout,
full=commit_full,
sync=commit_sync,
force_sync=commit_force_sync)
Expand Down
16 changes: 16 additions & 0 deletions tests/pb.juniper_junos_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,19 @@
ansible.builtin.assert:
that:
test8.changed == False
################
- name: Test commit timeout .
juniper.device.config:
load: 'merge'
lines:
- "set system host-name {{ inventory_hostname }}.foo"
comment: "Append .foo to the hostname"
timeout: 300
register: test2
ignore_errors: true
tags: [test2]

- name: Check TEST 2
ansible.builtin.assert:
that:
- test2.diff_lines

0 comments on commit ff81c02

Please sign in to comment.