Skip to content

Commit 688e0c5

Browse files
fix review comments (#768)
* fix review comments * fix review comments * Fixed pip install error * Fixed reboot RPC error handling * fix review comments * fix review comments * fix review comments * fixed yamllint error * v1.0.9 update * fix for white space error * fix for TypeError
1 parent 39668cf commit 688e0c5

File tree

25 files changed

+151
-67
lines changed

25 files changed

+151
-67
lines changed

.github/workflows/ansible_lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install ansible-lint from pip
4545
shell: bash
4646
run: |
47-
pip install ansible-compat==24.10.0 ansible-lint
47+
pip install ansible-compat==25.1.1 ansible-lint
4848
ansible-lint --version
4949
- name: Run ansible-lint
5050
shell: bash

ansible_collections/juniper/device/CHANGELOG.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@ Juniper Device Collection Release Notes
66
Changelog for Juniper Device Ansible Collection
77
===========================
88

9+
Version 1.0.9 (2025-09-23)
10+
---------------------------
11+
Enhancements
12+
------------
13+
- None
14+
15+
Bugs Fixed
16+
----------
17+
- Fixed the Software Installation RPC Error Handling #765
18+
- Fixed ansible lint issues #752
19+
- Fixed Ansible Automation Hub certification review comments #766
20+
- Fixed GitHub workflow minor issues. #751
21+
- Fixed Incorrect ConnectionError Exception Detection in software.py #770
22+
- Removed the deprecated Looseversion in Python3.12 and added support for packaging.version #771
23+
924
Version 1.0.8 (2025-04-30)
1025
---------------------------
1126
Enhancements

ansible_collections/juniper/device/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This modules requires the following to be installed on the Ansible control machi
6969
- [jxmlease](https://github.com/Juniper/jxmlease) 1.0.1 or later
7070
- [xmltodict](https://pypi.org/project/xmltodict/) 0.13.0 or later
7171
- [jsnapy](https://github.com/Juniper/jsnapy) 1.3.7 or later
72-
- [looseversion](https://github.com/effigies/looseversion) 1.3.0 or later
72+
- [packaging](https://github.com/pypa/packaging) 25.0 or later
7373

7474

7575
## Installation
@@ -207,4 +207,4 @@ Juniper Networks is actively contributing to and maintaining this repo. Please c
207207

208208
## License Information
209209

210-
Apache 2.0
210+
Apache 2.0

ansible_collections/juniper/device/galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace: juniper
99
name: device
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 1.0.8
12+
version: 1.0.9
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
requires_ansible: ">=2.17.0"
1+
requires_ansible: ">=2.16.0"

ansible_collections/juniper/device/plugins/connection/pyez.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def system_api(
842842
member_id=None,
843843
):
844844
"""Triggers the system calls like reboot, shutdown, halt and zeroize to device."""
845-
msg = None
845+
msg = ""
846846
if action != "zeroize":
847847
if at == "now" or (in_min == 0 and at is None):
848848
if self.dev.timeout > 5:
@@ -914,7 +914,7 @@ def software_api(self, install_params):
914914

915915
def reboot_api(self, all_re, vmhost, member_id=None):
916916
"""reboots the device."""
917-
msg = None
917+
msg = ""
918918
try:
919919
restore_timeout = self.dev.timeout
920920
if self.dev.timeout > 5:

ansible_collections/juniper/device/plugins/module_utils/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
__metaclass__ = type
3636

3737
try:
38-
from looseversion import LooseVersion
38+
from packaging.version import Version
3939

4040
HAS_LOOSE_VERSION = True
4141
except ImportError:
@@ -166,7 +166,7 @@ def _check_library(
166166
% (library_nickname, library_name, installation_url, library_name)
167167
)
168168
elif installed_version is not None and minimum is not None:
169-
if not LooseVersion(installed_version) >= LooseVersion(minimum):
169+
if not Version(installed_version) >= Version(minimum):
170170
return (
171171
"%s >= %s is required for this module. Version %s of "
172172
"%s is currently installed. See %s for details on "

ansible_collections/juniper/device/plugins/modules/software.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ def main():
791791
install_params.get("vmhost"),
792792
)
793793
except Exception as err: # pylint: disable=broad-except
794-
if "ConnectionError" in str(type(err)):
794+
if "ConnectionError" in str(err):
795795
# If Exception is ConnectionError, it is excpected
796796
# Device reboot inititated succesfully
797797
junos_module.logger.debug("Reboot RPC executed.")
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
ansible >= 2.10
21
junos-eznc >= 2.6.0
32
jsnapy>=1.3.6
43
jxmlease
54
xmltodict
6-
looseversion
5+
packaging

ansible_collections/juniper/device/tests/integration/targets/junos_config/tests/common/config.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
- name: Check TEST 1
1212
ansible.builtin.assert:
13-
that: test1.config
13+
that: test1.config is defined
1414

1515
- name: Append .foo to the hostname using private config mode.
1616
juniper.device.config:
@@ -26,7 +26,8 @@
2626
- name: Check TEST 2
2727
ansible.builtin.assert:
2828
that:
29-
- test2.failed == False
29+
- test2.diff_lines is defined
30+
- test2.diff_lines | length > 0
3031

3132
- name: Rollback to the previous config.
3233
juniper.device.config:
@@ -39,7 +40,8 @@
3940
- name: Check TEST 3
4041
ansible.builtin.assert:
4142
that:
42-
- test3.failed == False
43+
- test3.diff_lines is defined
44+
- test3.diff_lines | length > 0
4345

4446
- name: Save rescue configuration
4547
juniper.device.command:
@@ -62,7 +64,8 @@
6264
- name: Check TEST 4
6365
ansible.builtin.assert:
6466
that:
65-
- test4.failed == False
67+
- test4.diff_lines is defined
68+
- test4.diff_lines | length > 0
6669

6770
- name: Clean up TEST 4
6871
ansible.builtin.file:
@@ -146,4 +149,18 @@
146149
- name: Check TEST 9
147150
ansible.builtin.assert:
148151
that:
149-
- test9.failed == False
152+
- test2.diff_lines is defined
153+
- test2.diff_lines | length > 0
154+
155+
- name: Rollback to the previous config.
156+
juniper.device.config:
157+
rollback: 1
158+
register: test3
159+
ignore_errors: true
160+
tags: [test3]
161+
162+
- name: Check TEST 3
163+
ansible.builtin.assert:
164+
that:
165+
- test3.diff_lines is defined
166+
- test3.diff_lines | length > 0

0 commit comments

Comments
 (0)