From e41c87c1402d114a0d9cac56323aa4da19c0af9c Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Fri, 15 Oct 2021 12:11:26 +0200 Subject: [PATCH] added module for nextcloud state --- states/_modules/nextcloud.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 states/_modules/nextcloud.py diff --git a/states/_modules/nextcloud.py b/states/_modules/nextcloud.py new file mode 100644 index 0000000..f0c7831 --- /dev/null +++ b/states/_modules/nextcloud.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import re + +def get_version(configfile=None): + res = None + regex = re.compile(".*OC_Version.*\((\d+),(\d+),(\d+),(\d+).*") + with open(configfile, "r") as f: + lines = f.readlines() + for l in lines: + res = regex.match(l.strip("\n")) + if res: + return ".".join(res.groups()) + return ""