aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-01 21:46:54 -0700
committerelijah <elijah@riseup.net>2012-11-01 21:46:54 -0700
commit31c8c23bbb7e575be7c2231833dfec880c3d9d16 (patch)
tree7c1d00c704bcdca119af4289443ee378aec4795c /lib
parent134c09ef9e58dc52136610e480b13176a16d9715 (diff)
downloadleap_cli-31c8c23bbb7e575be7c2231833dfec880c3d9d16.tar.gz
leap_cli-31c8c23bbb7e575be7c2231833dfec880c3d9d16.tar.bz2
fixed generation of authorized_keys and known_hosts: now entries are sorted
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/commands/node.rb3
-rw-r--r--lib/leap_cli/commands/user.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb
index e200a19..d05e233 100644
--- a/lib/leap_cli/commands/node.rb
+++ b/lib/leap_cli/commands/node.rb
@@ -55,7 +55,8 @@ module LeapCli; module Commands
#
def update_known_hosts
buffer = StringIO.new
- manager.nodes.values.each do |node|
+ manager.nodes.keys.sort.each do |node_name|
+ node = manager.nodes[node_name]
hostnames = [node.name, node.domain.internal, node.domain.full, node.ip_address].join(',')
pub_key = read_file([:node_ssh_pub_key,node.name])
if pub_key
diff --git a/lib/leap_cli/commands/user.rb b/lib/leap_cli/commands/user.rb
index fbc366a..f0509ac 100644
--- a/lib/leap_cli/commands/user.rb
+++ b/lib/leap_cli/commands/user.rb
@@ -119,7 +119,7 @@ module LeapCli
def update_authorized_keys
buffer = StringIO.new
- Dir.glob(path([:user_ssh, '*'])).each do |keyfile|
+ Dir.glob(path([:user_ssh, '*'])).sort.each do |keyfile|
ssh_type, ssh_key = File.read(keyfile).strip.split(" ")
buffer << ssh_type
buffer << " "