Try/except because flarum has a nonutf8 file >_>

This commit is contained in:
Alexandre Aubin 2020-11-11 17:13:01 +01:00
parent bd199390cd
commit 6e0c314098

View file

@ -570,7 +570,12 @@ class Configurations(TestSuite):
if not filename.endswith(".service"): if not filename.endswith(".service"):
continue 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) matches = re.findall(r"^ *(User|Group)=(\S+)", content, flags=re.MULTILINE)
if not any(match[0] == "User" for match in matches): if not any(match[0] == "User" for match in matches):
yield Warning("You should specify a User= directive in the systemd config !") 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"): if not filename.startswith("php") or not filename.endswith(".conf"):
continue 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) matches = re.findall(r"^ *(user|group) = (\S+)", content, flags=re.MULTILINE)
if not any(match[0] == "user" for match in matches): 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") yield Warning("You should at least specify a user = directive in your php conf file")