diff options
-rw-r--r-- | lib/leap_cli/commands/deploy.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/commands/test.rb | 6 | ||||
-rw-r--r-- | lib/leap_cli/config/object_list.rb | 5 | ||||
-rw-r--r-- | lib/leap_cli/path.rb | 4 |
4 files changed, 9 insertions, 8 deletions
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb index 065a111..d7f5df8 100644 --- a/lib/leap_cli/commands/deploy.rb +++ b/lib/leap_cli/commands/deploy.rb @@ -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 diff --git a/lib/leap_cli/commands/test.rb b/lib/leap_cli/commands/test.rb index 80a6333..1da4f6d 100644 --- a/lib/leap_cli/commands/test.rb +++ b/lib/leap_cli/commands/test.rb @@ -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 diff --git a/lib/leap_cli/config/object_list.rb b/lib/leap_cli/config/object_list.rb index 9001834..0c7711f 100644 --- a/lib/leap_cli/config/object_list.rb +++ b/lib/leap_cli/config/object_list.rb @@ -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 diff --git a/lib/leap_cli/path.rb b/lib/leap_cli/path.rb index 634284d..88837bd 100644 --- a/lib/leap_cli/path.rb +++ b/lib/leap_cli/path.rb @@ -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' } |