From 67dcf4a1563187510d65dd746c509e474c353f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 3 Jan 2018 22:34:52 +0000 Subject: [PATCH] cli: Fix image builder command order --- certidude/cli.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/certidude/cli.py b/certidude/cli.py index ea31874..7bb8226 100755 --- a/certidude/cli.py +++ b/certidude/cli.py @@ -1064,13 +1064,6 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country, else: click.echo("Not systemd based OS, don't know how to set up initscripts") - if os.path.exists("/etc/certidude/builder.conf"): - click.echo("Image builder config /etc/certidude/builder.conf already exists, remove to regenerate") - else: - with open("/etc/certidude/builder.conf", "w") as fh: - fh.write(env.get_template("server/builder.conf").render(vars())) - click.echo("File /etc/certidude/builder.conf created") - assert os.getuid() == 0 and os.getgid() == 0 bootstrap_pid = os.fork() if not bootstrap_pid: @@ -1080,6 +1073,7 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country, for path in bundle_js, bundle_css: subdir = os.path.dirname(path) if not os.path.exists(subdir): + click.echo("Creating directory %s" % subdir) os.makedirs(subdir) # Install JavaScript pacakges @@ -1135,6 +1129,14 @@ def certidude_setup_authority(username, kerberos_keytab, nginx_config, country, fh.write(env.get_template("server/server.conf").render(vars())) click.echo("Generated %s" % const.SERVER_CONFIG_PATH) + # Create image builder config + if os.path.exists(const.BUILDER_CONFIG_PATH): + click.echo("Image builder config %s already exists, remove to regenerate" % const.BUILDER_CONFIG_PATH) + else: + with open(const.BUILDER_CONFIG_PATH, "w") as fh: + fh.write(env.get_template("server/builder.conf").render(vars())) + click.echo("File %s created" % const.BUILDER_CONFIG_PATH) + # Create directory with 755 permissions os.umask(0o022) if not os.path.exists(directory):