mirror of
https://bitbucket.org/atlassian-docker/docker-atlassian-confluence-server.git
synced 2024-08-30 18:22:16 +00:00
DCD-584: Don't overwrite confluence.cfg.xml if it already exists.
This commit is contained in:
parent
a4b7fde2b6
commit
c8632248dc
@ -21,7 +21,11 @@ jenv = j2.Environment(
|
|||||||
loader=j2.FileSystemLoader('/opt/atlassian/etc/'),
|
loader=j2.FileSystemLoader('/opt/atlassian/etc/'),
|
||||||
autoescape=j2.select_autoescape(['xml']))
|
autoescape=j2.select_autoescape(['xml']))
|
||||||
|
|
||||||
def gen_cfg(tmpl, target, env, user='root', group='root', mode=0o644):
|
def gen_cfg(tmpl, target, env, user='root', group='root', mode=0o644, overwrite=True):
|
||||||
|
if not overwrite and os.path.exists(target):
|
||||||
|
logging.info(f"{target} exists; skipping.")
|
||||||
|
return
|
||||||
|
|
||||||
logging.info(f"Generating {target} from template {tmpl}")
|
logging.info(f"Generating {target} from template {tmpl}")
|
||||||
cfg = jenv.get_template(tmpl).render(env)
|
cfg = jenv.get_template(tmpl).render(env)
|
||||||
with open(target, 'w') as fd:
|
with open(target, 'w') as fd:
|
||||||
@ -55,7 +59,8 @@ gen_cfg('confluence-init.properties.j2',
|
|||||||
|
|
||||||
gen_cfg('confluence.cfg.xml.j2',
|
gen_cfg('confluence.cfg.xml.j2',
|
||||||
f"{env['confluence_home']}/confluence.cfg.xml", env,
|
f"{env['confluence_home']}/confluence.cfg.xml", env,
|
||||||
user=env['run_user'], group=env['run_group'], mode=0o640)
|
user=env['run_user'], group=env['run_group'], mode=0o640,
|
||||||
|
overwrite=False)
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user