commit:     1efec8d12b9cab3b706741dd2cd233d702ca4476
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 24 03:42:21 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Feb 24 03:42:21 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ag.git;a=commit;h=1efec8d1

Cleanup check.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 lib/storage.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/storage.rb b/lib/storage.rb
index 4135971..fe50ea8 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -6,13 +6,13 @@ module Ag::Storage
   module_function
 
   def index_status(indexname)
-    $es.cluster.health(level: :indices)['indices'][indexname]['status']
+    $es.cluster.health(level: :indices)['indices'][indexname]['status'] || 
'FAIL'
   end
 
   def index_ready?(indexname)
-    status = index_status(indexname) 
+    # watch out if you rewrite this
     # if you call index_status twice, you might get different results!
-    return status == 'green' or status == 'yellow'
+    [:green, :yellow].include? index_status(indexname).downcase.to_sym
   end
 
   # Throws Elasticsearch::Transport::Transport::Errors::NotFound

Reply via email to