Skip to content
Browse files

Remove project name from metadata lookup if the project name is empty…

…. This preserves backwards compatability with Rudy projects that are created without a project set.
  • Loading branch information...
1 parent 43184c0 commit c0d732b3f663afa0aefa6bd4bc897d391ee65945 @Fluxx Fluxx committed
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/rudy/metadata.rb
View
4 lib/rudy/metadata.rb
@@ -88,6 +88,9 @@ def self.select(fields={})
# Generates a default criteria for all metadata based on
# region, zone, environment, and role. If a position has
# been specified in the globals it will also be included.
+ # The project name will also be removed if empty, to
+ # maintain backwards compatability with metadata entries
+ # that do not contain a projet field.
# * +rtype+ is the record type. One of: m, disk, or back.
# * +fields+ replaces and adds values to this criteria
# * +less+ removes keys from the default criteria.
@@ -102,6 +105,7 @@ def self.build_criteria(rtype, fields={}, less=[])
mixer = names.zip(values).flatten
criteria = Hash[*mixer].merge(fields)
criteria.reject! { |n,v| less.member?(n) }
+ criteria.delete(:project) if criteria[:project].to_s.empty?
Rudy::Huxtable.ld "CRITERIA: #{criteria.inspect}"
criteria
end

0 comments on commit c0d732b

Please sign in to comment.
Something went wrong with that request. Please try again.