]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
lock version for allowed platform & add authorized_keys support
authorelijah <elijah@riseup.net>
Wed, 26 Jun 2013 00:34:25 +0000 (17:34 -0700)
committerelijah <elijah@riseup.net>
Wed, 26 Jun 2013 00:34:25 +0000 (17:34 -0700)
lib/leap_cli/config/macros.rb
lib/leap_cli/leapfile.rb
lib/leap_cli/version.rb

index b3e730889236cb599fea358a244f928f5696b0d5..94ad034c7774a0e9662a65c3f04402430d1bce6a 100644 (file)
@@ -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
index f517620f44252f938d273e61e787680a17a1e4f2..de630355404c4baab49a1dc9233ad532d884253a 100644 (file)
@@ -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
 
         #
index 00df109fc136d87222b4d64631dc8a7b188da761..bdcb77fc6edf7c3d7242e1eabacbb9bee6de2a34 100644 (file)
@@ -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']