Skip to content

Commit 64b47b4

Browse files
committed
Use _version_check_greater instead of string comparison
1 parent 09653b9 commit 64b47b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/module_utils/netbox_tenancy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,16 @@ def run(self):
111111
# We need to check that the correct field is being used.
112112
if self.endpoint == NB_CONTACTS:
113113
if data.get("groups"):
114-
if self.version < "4.3":
114+
if not self._version_check_greater(
115+
self.version, "4.3", greater_or_equal=True
116+
):
115117
raise Exception(
116118
f"contact_groups is not available in Netbox {self.version}. Use contact_group instead, or upgrade to Netbox 4.3 or greater."
117119
)
118120
if data.get("group"):
119-
if self.version >= "4.3":
121+
if self._version_check_greater(
122+
self.version, "4.3", greater_or_equal=True
123+
):
120124
raise Exception(
121125
f"contact_group is not available in Netbox {self.version}. Use contact_groups instead."
122126
)

0 commit comments

Comments
 (0)