Skip to content

Commit

Permalink
Use packaging.version
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan committed Nov 24, 2023
1 parent a92c047 commit d68ff69
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 549 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if sys.version_info < (3, 6):
raise SystemExit('ERROR: zabbix-cli needs at least python 3.6 to work')

install_requires = ['requests']
install_requires = ['requests', 'packaging']

#
# Setup
Expand Down
199 changes: 0 additions & 199 deletions tests/test_version.py

This file was deleted.

11 changes: 6 additions & 5 deletions zabbix_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
import textwrap
import time

from packaging.version import Version

import zabbix_cli
import zabbix_cli.apiutils
import zabbix_cli.utils
from zabbix_cli.prettytable import ALL, FRAME, PrettyTable
from zabbix_cli.pyzabbix import ZabbixAPI
from zabbix_cli.version import StrictVersion

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -4935,8 +4936,8 @@ def do_acknowledge_event(self, args):
return False

# Hotfix for Zabbix 4.0 compability
api_version = StrictVersion(self.zapi.api_version())
if api_version >= StrictVersion("4.0"):
api_version = Version(self.zapi.api_version())
if api_version >= Version("4.0"):
if close == 'false':
action = 6 # "Add message" and "Acknowledge"
elif close == 'true':
Expand Down Expand Up @@ -5050,8 +5051,8 @@ def do_acknowledge_trigger_last_event(self, args):
event_ids.append(data[0]['eventid'])

# Hotfix for Zabbix 4.0 compability
api_version = StrictVersion(self.zapi.api_version())
if api_version >= StrictVersion("4.0"):
api_version = Version(self.zapi.api_version())
if api_version >= Version("4.0"):
if close == 'false':
action = 6 # "Add message" and "Acknowledge"
elif close == 'true':
Expand Down
Loading

0 comments on commit d68ff69

Please sign in to comment.