Commit f1efbb09 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

deploy/ci: Small refactor regarding ssh/ddns keys

In case `keygen` founds the keys it does nothing. If `--force` is
passed then it re-creates the keys.

Currently ci installs the deploy package during `build` command.
Move keygen action from ci's `deploy_synnefo` phase to the
`build_synnefo` phase.

Do not use the `--force` flag so that deploy can be re-entrant on
any level.
Signed-off-by: default avatarDimitris Aragiorgis <>
parent 19fa4790
......@@ -844,6 +844,7 @@ class SynnefoCI(object):
cmd = """
dpkg -i snf-deploy*.deb
apt-get -f install --yes --force-yes
snf-deploy keygen
with fabric.settings(warn_only=True):
......@@ -919,7 +920,6 @@ class SynnefoCI(object):
self.logger.debug("Run snf-deploy")
cmd = """
snf-deploy keygen --force
snf-deploy --disable-colors --autoconf all
_run(cmd, True)
......@@ -586,13 +586,14 @@ def main():
# Check if there are keys to use
if args.command == "keygen":
if not args.force:
if not must_create_keys(env) or not must_create_ddns_keys(env):
print "Keys already exist.."
print "To override existing ones use --force."
return 1
do_create_keys(args, env)
do_create_ddns_keys(args, env)
if must_create_keys(env) or args.force:
do_create_keys(args, env)
print "ssh keys found. To re-create them use --force"
if must_create_ddns_keys(env) or args.force:
do_create_ddns_keys(args, env)
print "ddns keys found. To re-create them use --force"
return 0
if ((args.key_inject and not args.ssh_key and
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment