From c033a0ff259d89e937a371335d67b1975dca6354 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 25 Jun 2013 17:34:25 -0700 Subject: lock version for allowed platform & add authorized_keys support --- lib/leap_cli/config/macros.rb | 16 ++++++++++++++++ lib/leap_cli/leapfile.rb | 7 ++++++- lib/leap_cli/version.rb | 3 ++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb index b3e7308..94ad034 100644 --- a/lib/leap_cli/config/macros.rb +++ b/lib/leap_cli/config/macros.rb @@ -262,5 +262,21 @@ module LeapCli; module Config end end + # + # creates a hash from the ssh key info in users directory, for use in updating authorized_keys file + # + def authorized_keys + hash = {} + Dir.glob(Path.named_path([:user_ssh, '*'])).sort.each do |keyfile| + ssh_type, ssh_key = File.read(keyfile).strip.split(" ") + name = File.basename(File.dirname(keyfile)) + hash[name] = { + "type" => ssh_type, + "key" => ssh_key + } + end + hash + end + end end; end diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index f517620..de63035 100644 --- a/lib/leap_cli/leapfile.rb +++ b/lib/leap_cli/leapfile.rb @@ -41,7 +41,12 @@ module LeapCli # require "#{@platform_directory_path}/platform.rb" if !Leap::Platform.compatible_with_cli?(LeapCli::VERSION) - Util.bail! "This leap command (version #{LeapCli::VERSION}) is not compatible with the platform #{@platform_directory_path} (which requires #{Platform.compatible_cli.first} to #{Platform.compatible_cli.last})." + Util.bail! "This leap command (version #{LeapCli::VERSION}) is not compatible with the platform #{@platform_directory_path} " + + "(which requires leap command #{Platform.compatible_cli.first} to #{Platform.compatible_cli.last})." + end + if !Leap::Platform.version_in_range?(LeapCli::COMPATIBLE_PLATFORM_VERSION) + Util.bail! "This leap command (version #{LeapCli::VERSION}) is not compatible with the platform #{@platform_directory_path} " + + "(leap command requires which requires platform #{LeapCli::COMPATIBLE_PLATFORM_VERSION.first} to #{LeapCli::COMPATIBLE_PLATFORM_VERSION.last})." end # diff --git a/lib/leap_cli/version.rb b/lib/leap_cli/version.rb index 00df109..bdcb77f 100644 --- a/lib/leap_cli/version.rb +++ b/lib/leap_cli/version.rb @@ -1,6 +1,7 @@ module LeapCli unless defined?(LeapCli::VERSION) - VERSION = '1.1.1' + VERSION = '1.1.2' + COMPATIBLE_PLATFORM_VERSION = '1.1.2'..'1.99' SUMMARY = 'Command line interface to the LEAP platform' DESCRIPTION = 'The command "leap" can be used to manage a bevy of servers running the LEAP platform from the comfort of your own home.' LOAD_PATHS = ['lib', 'vendor/certificate_authority/lib', 'vendor/rsync_command/lib'] -- cgit v1.2.3