From 6e0c31409848961dbf6e85edaad74e4953c5153a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 11 Nov 2020 17:13:01 +0100 Subject: [PATCH] Try/except because flarum has a nonutf8 file >_> --- package_linter.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/package_linter.py b/package_linter.py index 8396760..5b5320c 100755 --- a/package_linter.py +++ b/package_linter.py @@ -570,7 +570,12 @@ class Configurations(TestSuite): if not filename.endswith(".service"): continue - content = open(app.path + "/conf/" + filename).read() + try: + content = open(app.path + "/conf/" + filename).read() + except Exception as e: + yield Warning("Can't open/read %s : %s" % (filename, e)) + return + matches = re.findall(r"^ *(User|Group)=(\S+)", content, flags=re.MULTILINE) if not any(match[0] == "User" for match in matches): yield Warning("You should specify a User= directive in the systemd config !") @@ -588,7 +593,12 @@ class Configurations(TestSuite): if not filename.startswith("php") or not filename.endswith(".conf"): continue - content = open(app.path + "/conf/" + filename).read() + try: + content = open(app.path + "/conf/" + filename).read() + except Exception as e: + yield Warning("Can't open/read %s : %s" % (filename, e)) + return + matches = re.findall(r"^ *(user|group) = (\S+)", content, flags=re.MULTILINE) if not any(match[0] == "user" for match in matches): yield Warning("You should at least specify a user = directive in your php conf file")