fixup
* update version regex to succesfully match only the version string + add missing import
This commit is contained in:
parent
7ca08b12c0
commit
331adaf820
6
api.py
6
api.py
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
class EjabberdApi:
|
class EjabberdApi:
|
||||||
"""
|
"""
|
||||||
|
@ -32,12 +32,12 @@ class EjabberdApi:
|
||||||
@property
|
@property
|
||||||
def verstring(self):
|
def verstring(self):
|
||||||
if self._login is not None:
|
if self._login is not None:
|
||||||
ver_str = re.compile('([1-9][0-9.]+)')
|
ver_str = re.compile('([1-9][0-9.]+(?![.a-z]))\\b')
|
||||||
status = self.cmd('status', {})
|
status = self.cmd('status', {})
|
||||||
|
|
||||||
# matches
|
# matches
|
||||||
try:
|
try:
|
||||||
tmp = ver_str.findall(status)[1]
|
tmp = ver_str.findall(status)[0]
|
||||||
# raise SystemExit code 17 if no status message is received
|
# raise SystemExit code 17 if no status message is received
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise SystemExit(17)
|
raise SystemExit(17)
|
||||||
|
|
Loading…
Reference in New Issue