]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Don't run a SOLR search with a completely empty string in get_mon_nodes()
authorGreg Farnum <greg@inktank.com>
Mon, 10 Sep 2012 20:04:03 +0000 (13:04 -0700)
committerGreg Farnum <greg@inktank.com>
Mon, 10 Sep 2012 20:04:03 +0000 (13:04 -0700)
It's not clear to me exactly how this gets run when there are no monitors
available to be querying, but I've seen it happen.

libraries/default.rb

index 96f4c8133352dde39b6a2bb8a0e9fc81a8f4c16b..9a9a0c0351589878c271e892c2bcff07a297253b 100644 (file)
@@ -13,10 +13,13 @@ def get_mon_nodes(extra_search=nil)
     search_string = "role:ceph-mon AND chef_environment:#{node.chef_environment}"
   end
 
-  if not extra_search.nil?
+  if not search_string.nil? and not extra_search.nil?
     search_string = "(#{search_string}) AND (#{extra_search})"
   end
-  mons = search(:node, search_string)
+  mons = {}
+  if not search_string.nil?
+    mons = search(:node, search_string)
+  end
   return mons
 end