diff options
Diffstat (limited to 'lib/leap_cli/config')
-rw-r--r-- | lib/leap_cli/config/macros.rb | 3 | ||||
-rw-r--r-- | lib/leap_cli/config/object_list.rb | 20 |
2 files changed, 12 insertions, 11 deletions
diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb index 3c59356..5f90894 100644 --- a/lib/leap_cli/config/macros.rb +++ b/lib/leap_cli/config/macros.rb @@ -21,6 +21,9 @@ module LeapCli; module Config # # returns a list of nodes that match the same environment # + # if @node.environment is not set, we return other nodes + # where environment is not set. + # def nodes_like_me nodes[:environment => @node.environment] end diff --git a/lib/leap_cli/config/object_list.rb b/lib/leap_cli/config/object_list.rb index 0c7711f..0c0da14 100644 --- a/lib/leap_cli/config/object_list.rb +++ b/lib/leap_cli/config/object_list.rb @@ -40,17 +40,15 @@ module LeapCli operator = match_value =~ /^!/ ? :not_equal : :equal each do |name, config| value = config[field] - if !value.nil? - if value.is_a? Array - if value.include?(match_value) - results[name] = config - end - else - if operator == :equal && value == match_value - results[name] = config - elsif operator == :not_equal && value != match_value - results[name] = config - end + if value.is_a? Array + if value.include?(match_value) + results[name] = config + end + else + if operator == :equal && value == match_value + results[name] = config + elsif operator == :not_equal && value != match_value + results[name] = config end end end |