aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-06-25 12:47:05 -0700
committerelijah <elijah@riseup.net>2014-06-25 12:47:05 -0700
commit51fb645e07b0bd2b567fd44e465acdfc958d817a (patch)
treeb480396ae1a8851634ad3da72f04ddb470866749
parent3ddd8e93a161d748e5703b0856cb2eded0dd19c5 (diff)
downloadleap_cli-51fb645e07b0bd2b567fd44e465acdfc958d817a.tar.gz
leap_cli-51fb645e07b0bd2b567fd44e465acdfc958d817a.tar.bz2
ensure that monitor key directories exist before trying to generate the monitor ssh keys
-rw-r--r--lib/leap_cli/commands/compile.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/leap_cli/commands/compile.rb b/lib/leap_cli/commands/compile.rb
index e96cb6a..63c2047 100644
--- a/lib/leap_cli/commands/compile.rb
+++ b/lib/leap_cli/commands/compile.rb
@@ -50,14 +50,16 @@ module LeapCli
# keys, and every monitor node has a copy of the private monitor key.
#
def generate_monitor_ssh_keys
- priv_key_file = :monitor_priv_key
- pub_key_file = :monitor_pub_key
+ priv_key_file = path(:monitor_priv_key)
+ pub_key_file = path(:monitor_pub_key)
unless file_exists?(priv_key_file, pub_key_file)
- cmd = %(ssh-keygen -N '' -C 'monitor' -t ecdsa -b 521 -f '%s') % path(priv_key_file)
+ ensure_dir(File.dirname(priv_key_file))
+ ensure_dir(File.dirname(pub_key_file))
+ cmd = %(ssh-keygen -N '' -C 'monitor' -t ecdsa -b 521 -f '%s') % priv_key_file
assert_run! cmd
if file_exists?(priv_key_file, pub_key_file)
- log :created, path(priv_key_file)
- log :created, path(pub_key_file)
+ log :created, priv_key_file
+ log :created, pub_key_file
else
log :failed, 'to create monitor ssh keys'
end