aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-06-25 17:34:25 -0700
committerelijah <elijah@riseup.net>2013-06-25 17:34:25 -0700
commitc033a0ff259d89e937a371335d67b1975dca6354 (patch)
tree69cf4e40d15040f3ab5f8f96a5c03072385403a9
parent0ffdf42cf2171deb0bdd4c54f8281c1c1257ee86 (diff)
downloadleap_cli-c033a0ff259d89e937a371335d67b1975dca6354.tar.gz
leap_cli-c033a0ff259d89e937a371335d67b1975dca6354.tar.bz2
lock version for allowed platform & add authorized_keys support
-rw-r--r--lib/leap_cli/config/macros.rb16
-rw-r--r--lib/leap_cli/leapfile.rb7
-rw-r--r--lib/leap_cli/version.rb3
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']