]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
fixed misc. bugs with switch to 'environment' flag.
authorelijah <elijah@riseup.net>
Mon, 11 Mar 2013 01:06:32 +0000 (18:06 -0700)
committerelijah <elijah@riseup.net>
Mon, 11 Mar 2013 01:06:32 +0000 (18:06 -0700)
lib/leap_cli/commands/deploy.rb
lib/leap_cli/commands/test.rb
lib/leap_cli/config/object_list.rb
lib/leap_cli/path.rb

index 065a1119d0776ab04379ad64295498f7fb8d9839..d7f5df8c0b5ea509e29c1e710354cc0cdf0d69c8 100644 (file)
@@ -147,7 +147,7 @@ module LeapCli
     def filter_deploy_nodes(filter)
       nodes = manager.filter!(filter)
       if !leapfile.allow_production_deploy
-        nodes = nodes[:production => false]
+        nodes = nodes[:environment => "!production"]
         assert! nodes.any?, "Skipping deploy because @allow_production_deploy is disabled."
       end
       nodes
index 80a6333886b5d7e2807270cc3ba1f0ace4401fd4..1da4f6d84d1d5ca73f7871a904e18446f9d777fe 100644 (file)
@@ -25,11 +25,11 @@ module LeapCli; module Commands
   def generate_test_client_openvpn_config
     template = read_file! Path.find_file(:test_client_openvpn_template)
 
-    ['production', 'testing', 'local'].each do |tag|
-      vpn_nodes = manager.nodes[:tags => tag][:services => 'openvpn']
+    ['production', 'testing', 'local', 'development'].each do |env|
+      vpn_nodes = manager.nodes[:environment => env][:services => 'openvpn']
       if vpn_nodes.any?
         config = Util.erb_eval(template, binding)
-        write_file! ('test_openvpn_'+tag).to_sym, config
+        write_file! [:test_openvpn_config, env], config
       end
     end
   end
index 9001834bd2be8384c6701fb1535cda560247ab3a..0c7711f0bc8329026c43fe617ebb344826ef690a 100644 (file)
@@ -37,6 +37,7 @@ module LeapCli
           key.each do |field, match_value|
             field = field.is_a?(Symbol) ? field.to_s : field
             match_value = match_value.is_a?(Symbol) ? match_value.to_s : match_value
+            operator = match_value =~ /^!/ ? :not_equal : :equal
             each do |name, config|
               value = config[field]
               if !value.nil?
@@ -45,7 +46,9 @@ module LeapCli
                     results[name] = config
                   end
                 else
-                  if value == match_value
+                  if operator == :equal && value == match_value
+                    results[name] = config
+                  elsif operator == :not_equal && value != match_value
                     results[name] = config
                   end
                 end
index 634284dd5083633b28bf6207203d82b4ba2606f8..88837bd4717c3254c4112ac91e06bb2355845265 100644 (file)
@@ -51,9 +51,7 @@ module LeapCli; module Path
     # testing files
     :test_client_key     => 'test/cert/client.key',
     :test_client_cert    => 'test/cert/client.crt',
-    :test_openvpn_production  => 'test/openvpn/production.ovpn',
-    :test_openvpn_testing     => 'test/openvpn/testing.ovpn',
-    :test_openvpn_local       => 'test/openvpn/local.ovpn',
+    :test_openvpn_config => 'test/openvpn/#{arg}.ovpn',
     :test_client_openvpn_template => 'test/openvpn/client.ovpn.erb'
   }