1
0
mirror of https://github.com/zokradonh/kopano-docker.git synced 2026-08-11 16:32:59 +00:00

Disable some checks when deploying with injected cfg files (#295)

* Add variables to disable some checks that aren't needed if you inject the cfg files
* add tests for new functionality
* uncomment write protected test

fixes https://github.com/zokradonh/kopano-docker/pull/296
This commit is contained in:
RobinvG
2019-11-27 14:56:27 +01:00
committed by Felix Bartels
parent d7fb796fa3
commit edf4086d7e
5 changed files with 64 additions and 25 deletions
+8 -3
View File
@@ -4,6 +4,7 @@ via environment variables"""
import re
import os
import os.path
import sys
def configkopano(configs):
""" Changes configuration files according to configs typically returned from parseenvironmentvariables(..)"""
@@ -34,9 +35,13 @@ def configkopano(configs):
contents = re.sub(r"^\s*#?\s*{}\s*=.*".format(key), r"{} = {}".format(key, newvalue), contents, 0, re.MULTILINE)
# save new configuration
with open(filename, "w") as f:
f.write(contents)
f.close()
try:
with open(filename, "w") as f:
f.write(contents)
f.close()
except (OSError, PermissionError):
print("Can't open {}, ignoring file changes".format(filename))
def parseenvironmentvariables(prependingpath):
""" Parse all environment variables starting with KCCONF_, KCCOMMENT_ and KCUNCOMMENT_ and