Skip to content

Commit ec3b584

Browse files
committed
Use a env var for bigbang in docker-initialize.py
1 parent 0c3055f commit ec3b584

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

docker/docker-initialize.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ def __init__(
2323
self.mq_ws_url = "https://" + env.get("MQ_WS_URL", "019999")
2424
self.mq_ws_login = env.get("MQ_WS_LOGIN", "testuser")
2525
self.mq_ws_password = env.get("MQ_WS_PASSWORD", "test")
26-
self.hostname = env.get('HOSTNAME')
26+
self.hostname = env.get("HOSTNAME")
27+
self.bigbang = env.get("BIGBANG", "False")
2728

2829
self.instance1_conf = '/plone/parts/instance/etc/zope.conf'
2930
self.instance_amqp_conf = '/plone/parts/instance-amqp/etc/zope.conf'
3031
self.instance_async_conf = '/plone/parts/instance-async/etc/zope.conf'
3132
self.instance_debug_conf = '/plone/parts/instance-debug/etc/zope.conf'
3233
self.zeoserver_conf = '/plone/parts/zeoserver/etc/zeo.conf'
3334

34-
def _fix(self, path, activate_big_bang):
35+
def _fix(self, path):
3536
with open(path) as file:
3637
filedata = file.read()
3738
filedata = re.sub(r'server.*?8100', 'server ' + self.server, filedata)
@@ -41,16 +42,16 @@ def _fix(self, path, activate_big_bang):
4142
filedata = re.sub(r'cache-size.*?1000MB', 'cache-size ' + self.zeo_client_cache_size, filedata)
4243
filedata = re.sub(r'cache-size.*?100000', 'cache-size ' + self.zodb_cache_size, filedata)
4344
filedata = filedata.replace('Plone/@@cron-tick', self.plone_path + '/@@cron-tick ')
44-
filedata = re.sub(r'ACTIVE_BIGBANG.*?(True|False)', 'ACTIVE_BIGBANG ' + str(activate_big_bang), filedata)
45+
filedata = re.sub(r'ACTIVE_BIGBANG.*?(True|False)', 'ACTIVE_BIGBANG ' + self.bigbang, filedata)
4546
filedata = re.sub(r'path /data/log/instance.*.log', 'path /data/log/' + self.hostname + '.log', filedata)
4647
filedata = re.sub(r'path /plone/var/log/instance.*-Z2.log',
4748
'path /data/log/' + self.hostname + '-Z2.log',
48-
filedata)
49+
filedata)<
4950
filedata = re.sub(r'SITE_ID .*', 'SITE_ID ' + self.plone_path, filedata)
5051
return filedata
5152

52-
def _fix_conf(self, path, activate_big_bang):
53-
filedata = self._fix(path, activate_big_bang)
53+
def _fix_conf(self, path):
54+
filedata = self._fix(path)
5455
filedata = re.sub(r'password.*?admin', 'password ' + self.admin_password, filedata)
5556
filedata = re.sub(r'ADMIN_PASSWORD.*?admin', 'ADMIN_PASSWORD ' + self.admin_password, filedata)
5657
with open(path, 'w') as file:
@@ -83,14 +84,14 @@ def _fix_amqp(self, path):
8384
def fixtures(self):
8485
""" ZEO Client
8586
"""
86-
self._fix_conf(self.instance1_conf, True)
87-
self._fix_conf(self.instance_async_conf, False)
88-
self._fix_conf(self.instance_amqp_conf, False)
87+
self._fix_conf(self.instance1_conf)
88+
self._fix_conf(self.instance_async_conf)
89+
self._fix_conf(self.instance_amqp_conf)
8990
# instance debug doesn't exist in dev env
9091
if os.path.exists(self.instance_debug_conf):
91-
self._fix_conf(self.instance_debug_conf, False)
92+
self._fix_conf(self.instance_debug_conf)
9293
self._fix_amqp(self.instance_debug_conf)
93-
self._fix_conf(self.zeoserver_conf, False)
94+
self._fix_conf(self.zeoserver_conf)
9495
self._fix_amqp(self.instance1_conf)
9596
self._fix_amqp(self.instance_amqp_conf)
9697

0 commit comments

Comments
 (0)