mirror of
https://github.com/KevinMidboe/mktxp-no-cli.git
synced 2025-10-29 17:50:23 +00:00
Add Parsing of the routeros version for capsman metrics
This commit is contained in:
@@ -324,6 +324,19 @@ def parse_ros_version(string):
|
||||
version, channel = re.findall(r'([\d\.]+).*?([\w]+)', string)[0]
|
||||
return packaging.version.parse(version), channel
|
||||
|
||||
def is_wifi_version(string):
|
||||
"""Try to check if the version is Wifi version of RouterOS (> 7.13).
|
||||
If anything goes wrong, return None.
|
||||
Returns a boolean"""
|
||||
try:
|
||||
cur_version, _ = parse_ros_version(string)
|
||||
if cur_version >= packaging.version.parse('7.13'):
|
||||
return True
|
||||
except Exception as err:
|
||||
print(f'could not get current RouterOS version, because: {str(err)}')
|
||||
|
||||
return False
|
||||
|
||||
def check_for_updates(cur_version):
|
||||
"""Try to check if there is a newer version available.
|
||||
If anything goes wrong, it returns the same version.
|
||||
|
||||
Reference in New Issue
Block a user