public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Alex Legler" <a3li@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/infra-status:master commit in: lib/
Date: Mon, 12 May 2014 14:59:49 +0000 (UTC)	[thread overview]
Message-ID: <1399906801.45d9d907f809c246d635c09b95635282a3dd5140.a3li@gentoo> (raw)

commit:     45d9d907f809c246d635c09b95635282a3dd5140
Author:     Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Mon May 12 15:00:01 2014 +0000
Commit:     Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Mon May 12 15:00:01 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/infra-status.git;a=commit;h=45d9d907

Return NA when a service has no data for a given host.

---
 lib/service_registry.rb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/service_registry.rb b/lib/service_registry.rb
index e374f1f..c6d208a 100644
--- a/lib/service_registry.rb
+++ b/lib/service_registry.rb
@@ -7,6 +7,7 @@ module State
   UP=1
   DOWN=2
   WARNING=3
+  NA=0
 end
 
 module HelperMethods
@@ -44,6 +45,10 @@ module HelperMethods
         status_data['services'][host][service]['is_flapping'] != 0
   end
 
+  def has_service?(host, service)
+    status_data['services'][host].has_key?(service)
+  end
+
   def default(host, service = nil)
     if service == nil
       if host_flapping? host
@@ -54,6 +59,8 @@ module HelperMethods
         State::DOWN
       end
     else
+      return State::NA unless has_service? host, service
+
       if service_flapping? host, service
         State::WARNING
       elsif service_up? host, service


             reply	other threads:[~2014-05-12 14:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 14:59 Alex Legler [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-03 18:48 [gentoo-commits] proj/infra-status:master commit in: lib/ Robin H. Johnson
2014-08-03 18:43 Robin H. Johnson
2014-08-03 18:41 Robin H. Johnson
2014-08-03 18:37 Robin H. Johnson
2014-04-30 12:12 Alex Legler
2014-04-26 14:35 Alex Legler
2014-04-17 16:59 Alex Legler
2014-04-17 16:52 Alex Legler
2014-01-18 12:10 Alex Legler
2014-01-16 16:43 ` Alex Legler
2014-01-18 12:10 Alex Legler
2014-01-16 16:43 ` Alex Legler
2014-01-16 16:43 Alex Legler
2014-01-18 12:10 ` Alex Legler
2014-01-16 16:43 Alex Legler
2014-01-18 12:10 ` Alex Legler
2013-11-12  9:21 Alex Legler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399906801.45d9d907f809c246d635c09b95635282a3dd5140.a3li@gentoo \
    --to=a3li@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox