Commit dfdb8ad3 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Christos Stavrakakis
Browse files

Pass key_inject in setup_env


Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent e84191ec
...@@ -16,13 +16,14 @@ from snfdeploy import massedit ...@@ -16,13 +16,14 @@ from snfdeploy import massedit
def setup_env(confdir="conf", packages="packages", def setup_env(confdir="conf", packages="packages",
templates="files", cluster_name="ganeti1", autoconf=False, disable_colors=False): templates="files", cluster_name="ganeti1", autoconf=False, disable_colors=False, key_inject=False):
print("Loading configuration for synnefo...") print("Loading configuration for synnefo...")
print(" * Using config files under %s..." % confdir) print(" * Using config files under %s..." % confdir)
print(" * Using %s and %s for packages and templates accordingly..." % (packages, templates)) print(" * Using %s and %s for packages and templates accordingly..." % (packages, templates))
autoconf = ast.literal_eval(autoconf) autoconf = ast.literal_eval(autoconf)
disable_colors = ast.literal_eval(disable_colors) disable_colors = ast.literal_eval(disable_colors)
env.key_inject = ast.literal_eval(key_inject)
conf = Conf.configure(confdir=confdir, cluster_name=cluster_name, autoconf=autoconf) conf = Conf.configure(confdir=confdir, cluster_name=cluster_name, autoconf=autoconf)
env.env = Env(conf) env.env = Env(conf)
...@@ -226,8 +227,11 @@ def check_ssh(): ...@@ -226,8 +227,11 @@ def check_ssh():
@roles("ips") @roles("ips")
def add_keys(): def add_keys():
if not ast.literal_eval(env.env.key_inject): if not env.key_inject:
debug(env.host, "Skipping ssh keys injection..") debug(env.host, "Skipping ssh keys injection..")
return
else:
debug(env.host, "Adding rsa/dsa keys..")
try_run("mkdir -p /root/.ssh") try_run("mkdir -p /root/.ssh")
cmd = """ cmd = """
for f in $(ls /root/.ssh/*); do for f in $(ls /root/.ssh/*); do
......
...@@ -255,9 +255,9 @@ def fabcommand(args, env, actions, nodes=[]): ...@@ -255,9 +255,9 @@ def fabcommand(args, env, actions, nodes=[]):
fabcmd += " --fabfile {4}/fabfile.py \ fabcmd += " --fabfile {4}/fabfile.py \
setup_env:confdir={0},packages={1},templates={2},cluster_name={3},\ setup_env:confdir={0},packages={1},templates={2},cluster_name={3},\
autoconf={5},disable_colors={6} \ autoconf={5},disable_colors={6},key_inject={7} \
".format(args.confdir, env.packages, env.templates, args.cluster_name, ".format(args.confdir, env.packages, env.templates, args.cluster_name,
env.lib, args.autoconf, args.disable_colors) env.lib, args.autoconf, args.disable_colors, args.key_inject)
if nodes: if nodes:
hosts = [env.nodes_info[n].hostname for n in nodes] hosts = [env.nodes_info[n].hostname for n in nodes]
......
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