Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit c0d732b3f663afa0aefa6bd4bc897d391ee65945 1 parent 43184c0
Jeff Pollard authored June 11, 2011

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  lib/rudy/metadata.rb
4  lib/rudy/metadata.rb
@@ -88,6 +88,9 @@ def self.select(fields={})
88 88
     # Generates a default criteria for all metadata based on
89 89
     # region, zone, environment, and role. If a position has
90 90
     # been specified in the globals it will also be included.
  91
+    # The project name will also be removed if empty, to
  92
+    # maintain backwards compatability with metadata entries
  93
+    # that do not contain a projet field.
91 94
     # * +rtype+ is the record type. One of: m, disk, or back.
92 95
     # * +fields+ replaces and adds values to this criteria
93 96
     # * +less+ removes keys from the default criteria. 
@@ -102,6 +105,7 @@ def self.build_criteria(rtype, fields={}, less=[])
102 105
       mixer = names.zip(values).flatten
103 106
       criteria = Hash[*mixer].merge(fields)
104 107
       criteria.reject! { |n,v| less.member?(n) }
  108
+      criteria.delete(:project) if criteria[:project].to_s.empty?
105 109
       Rudy::Huxtable.ld "CRITERIA: #{criteria.inspect}"
106 110
       criteria
107 111
     end

0 notes on commit c0d732b

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