[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Sebastien Coavoux s.coavoux at free.fr
Tue Feb 28 22:17:17 UTC 2012


The following commit has been merged in the debian/master branch:
commit cc173938484e400181a7c3689f5b823ee2bca586
Author: Sebastien Coavoux <s.coavoux at free.fr>
Date:   Sun Jan 29 14:22:27 2012 +0100

    Code Review.
    Fixed : typo in comments
    Fixed : misplaced comments
    Updated : licence in files
    Added : # -*- coding: utf-8 -*- in header
    Added : Info and Warning in some logger.log
    
    Personal Note :
    *Regarding to the skonfuiworker, don't worry Andreas ;).
     Licences will be updated in one big commit (sed is our friend)
    
    Feel free to (dis)agree

diff --git a/shinken/singleton.py b/shinken/singleton.py
index 754e039..d2ac6d3 100644
--- a/shinken/singleton.py
+++ b/shinken/singleton.py
@@ -1,32 +1,39 @@
 #!/usr/bin/env python
-#Copyright (C) 2009-2010 :
-#    Gabes Jean, naparuba at gmail.com
-#    Gerhard Lausser, Gerhard.Lausser at consol.de
-#    Gregory Starck, g.starck at gmail.com
-#    Hartmut Goebel, h.goebel at goebel-consult.de
+
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2009-2011 :
+#     Gabes Jean, naparuba at gmail.com
+#     Gerhard Lausser, Gerhard.Lausser at consol.de
+#     Gregory Starck, g.starck at gmail.com
+#     Hartmut Goebel, h.goebel at goebel-consult.de
 #
-#This file is part of Shinken.
+# This file is part of Shinken.
 #
-#Shinken is free software: you can redistribute it and/or modify
-#it under the terms of the GNU Affero General Public License as published by
-#the Free Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
+# Shinken is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-#Shinken is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#GNU Affero General Public License for more details.
+# Shinken is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#You should have received a copy of the GNU Affero General Public License
-#along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
+
 
 
-#The classic Singleton class. So all instance of this class will be the same
-#instance in fact.
 
 class Singleton(type):
+    """The classic Singleton class. So all instance of this class will be the same
+    instance in fact.
+    
+    """
+    
     def __init__(cls, name, bases, dict):
-        print "Init de singleton"
+        print "Info : Singleton Init"
         super(Singleton, cls).__init__(name, bases, dict)
         cls.instance = None
 
diff --git a/shinken/skonfuiworker.py b/shinken/skonfuiworker.py
index 01cf93a..a6ba6b1 100644
--- a/shinken/skonfuiworker.py
+++ b/shinken/skonfuiworker.py
@@ -1,36 +1,33 @@
 #!/usr/bin/env python
-# Copyright (C) 2009-2012 :
+
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2009-2011 :
 #     Gabes Jean, naparuba at gmail.com
 #     Gerhard Lausser, Gerhard.Lausser at consol.de
 #     Gregory Starck, g.starck at gmail.com
 #     Hartmut Goebel, h.goebel at goebel-consult.de
-#     Andreas Karfusehr, andreas at karfusehr.de
-# 
+#
 # This file is part of Shinken.
-# 
+#
 # Shinken is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # Shinken is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU Affero General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU Affero General Public License
 # along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
 
 
-# This class is used for poller and reactionner to work.
-# The worker is a process launch by theses process and read Message in a Queue
-# (self.s) (slave)
-# They launch the Check and then send the result in the Queue self.m (master)
-# they can die if they do not do anything (param timeout)
 
 from Queue import Empty
 
-# In android, we sould use threads, not process
+# In android, we sgould use threads, not process
 is_android = True
 try:
    import android
@@ -56,9 +53,13 @@ import signal
 from shinken.worker import Worker
 
 
-# SkonfuiWorker class is a sub one for the Worker one of the poller/reactionners
-# it just take it's jobs from the mongodb, instead of the queues()
+
 class SkonfUIWorker(Worker):
+    """SkonfuiWorker class is a sub one for the Worker one of the poller/reactionners
+     it just take it's jobs from the mongodb, instead of the queues()
+    
+    """
+    
     id = 0
     _process = None
     _mortal = None
@@ -76,7 +77,7 @@ class SkonfUIWorker(Worker):
 
 
     def get_scan_data(self):
-       print "I ask for a scan with the id", self.scan_asked
+       print "Info : I ask for a scan with the id", self.scan_asked
        scan_id = self.scan_asked.get('scan_id')
        # I search the scan entry in the asked_scans table
        cur = self.db.scans.find({'_id' : scan_id})
@@ -87,13 +88,13 @@ class SkonfUIWorker(Worker):
        
 
     def launch_scan(self):
-       print "I try to launch scan", self.scan
+       print "Info : I try to launch scan", self.scan
        scan_id = self.scan.get('_id')
        nmap = self.scan.get('use_nmap')
        vmware = self.scan.get('use_vmware')
        names = self.scan.get('names')
        state = self.scan.get('state')
-       print "IN SCAN WORKER:",nmap, vmware, names, state
+       print "Info : IN SCAN WORKER:",nmap, vmware, names, state
        
        # Updating the scan entry state
        self.db.scans.update({'_id' : scan_id}, { '$set': { 'state' : 'preparing' }})
@@ -102,7 +103,7 @@ class SkonfUIWorker(Worker):
        
        elts = names.splitlines()
        targets = ' '.join(elts)
-       print "Launching Nmap with targets", targets
+       print "Info : Launching Nmap with targets", targets
        macros = [('NMAPTARGETS', targets)]
        overwrite = False
        runners = ['nmap']
@@ -170,26 +171,26 @@ class SkonfUIWorker(Worker):
                try:
                 #print "I", self.id, "wait for a message"
                   msg = self.s.get(block=False)
-                  print "I", self.id, "I've got a message!", msg                  
+                  print "Info : I", self.id, "I've got a message!", msg                  
                   if msg is not None and msg.get_type() == 'ScanAsk':
                      self.scan_asked = msg.get_data()
                      self.get_scan_data()
                      self.launch_scan()
                except Empty , exp:
-                  print "UI worker go to sleep", self.id
+                  print "Info : UI worker go to sleep", self.id
                   time.sleep(1)
 
             # Now get order from master
             try:
                cmsg = c.get(block=False)
                if cmsg.get_type() == 'Die':
-                  print "[%d]Dad say we are dying..." % self.id
+                  print "Info : [%d]Dad say we are dying..." % self.id
                   break
                
             except :
                 pass
 
-            # Manage a possible time change (our avant will be change with the diff)
+            # Manage a possible time change (our evant will be change with the diff)
             diff = self.check_for_system_time_change()
             begin += diff
 
diff --git a/shinken/util.py b/shinken/util.py
index 106d01a..3968549 100644
--- a/shinken/util.py
+++ b/shinken/util.py
@@ -1,24 +1,27 @@
 #!/usr/bin/env python
-#Copyright (C) 2009-2010 :
-#    Gabes Jean, naparuba at gmail.com
-#    Gerhard Lausser, Gerhard.Lausser at consol.de
-#    Gregory Starck, g.starck at gmail.com
-#    Hartmut Goebel, h.goebel at goebel-consult.de
+
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2009-2011 :
+#     Gabes Jean, naparuba at gmail.com
+#     Gerhard Lausser, Gerhard.Lausser at consol.de
+#     Gregory Starck, g.starck at gmail.com
+#     Hartmut Goebel, h.goebel at goebel-consult.de
 #
-#This file is part of Shinken.
+# This file is part of Shinken.
 #
-#Shinken is free software: you can redistribute it and/or modify
-#it under the terms of the GNU Affero General Public License as published by
-#the Free Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
+# Shinken is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-#Shinken is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#GNU Affero General Public License for more details.
+# Shinken is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#You should have received a copy of the GNU Affero General Public License
-#along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
 
 import time
 import re
@@ -35,12 +38,9 @@ try:
     stdout_encoding = sys.stdout.encoding
     safe_stdout = (stdout_encoding == 'UTF-8')
 except Exception, exp:
-    print "Encoding detection error", exp
+    print "Error : Encoding detection error", exp
     safe_stdout = False
-#import locale
-#print locale.getdefaultlocale()
-#utf8_safe = (locale.getdefaultlocale() == ('en_US','UTF8'))
-#local_encoding = locale.getdefaultlocale()[1]
+
 
 ########### Strings #############
 # Try to print strings, but if there is an utf8 error, go in simple ascii mode
@@ -71,24 +71,24 @@ def safe_print(*args):
 
 
 ################################### TIME ##################################
-#@memoized
+# @memoized
 def get_end_of_day(year, month_id, day):
     end_time = (year, month_id, day, 23, 59, 59, 0, 0, -1)
     end_time_epoch = time.mktime(end_time)
     return end_time_epoch
 
 
-#@memoized
+# @memoized
 def print_date(t):
     return time.asctime(time.localtime(t))
 
 
-#@memoized
+# @memoized
 def get_day(t):
     return int(t - get_sec_from_morning(t))
 
 
-#@memoized
+# @memoized
 def get_sec_from_morning(t):
     t_lt = time.localtime(t)
     h = t_lt.tm_hour
@@ -97,7 +97,7 @@ def get_sec_from_morning(t):
     return h * 3600 + m * 60 + s
 
 
-#@memoized
+# @memoized
 def get_start_of_day(year, month_id, day):
     start_time = (year, month_id, day, 00, 00, 00, 0, 0, -1)
     try:
@@ -108,7 +108,7 @@ def get_start_of_day(year, month_id, day):
     return start_time_epoch
 
 
-#change a time in seconds like 3600 into a format : 0d 1h 0m 0s
+# change a time in seconds like 3600 into a format : 0d 1h 0m 0s
 def format_t_into_dhms_format(t):
     s = t
     m,s=divmod(s,60)
@@ -118,7 +118,7 @@ def format_t_into_dhms_format(t):
 
 
 ################################# Pythonization ###########################
-#first change to foat so manage for example 25.0 to 25
+#first change to float so manage for example 25.0 to 25
 def to_int(val):
     return int(float(val))
 
@@ -205,7 +205,7 @@ def to_svc_hst_distinct_lists(ref, tab):
     return r
 
 
-# Will expaand the value with macros from the
+# Will expand the value with macros from the
 # host/service ref before brok it
 def expand_with_macros(ref, value):
     return MacroResolver().resolve_simple_macros_in_string(value, ref.get_data_for_checks())
@@ -217,7 +217,7 @@ def get_obj_name(obj):
     return obj.get_name()
 
 # Same as before, but call with object,prop instead of just value
-# But if we got a 
+# But if we got an attribute error, return ''
 def get_obj_name_two_args_and_void(obj, value):
     try:
         return value.get_name()
@@ -324,7 +324,7 @@ def strip_and_uniq(tab):
 
 
 
-#################### Patern change application (mainly for host) #######
+#################### Pattern change application (mainly for host) #######
 
 def expand_xy_patern(pattern):
     ns = NodeSet(str(pattern))
@@ -338,13 +338,13 @@ def expand_xy_patern(pattern):
 
 
 
-#This function is used to generate all patern change as
-#recursive list.
-#for example, for a [(1,3),(1,4),(1,5)] xy_couples,
-#it will generate a 60 item list with:
-#Rule: [1, '[1-5]', [1, '[1-4]', [1, '[1-3]', []]]]
-#Rule: [1, '[1-5]', [1, '[1-4]', [2, '[1-3]', []]]]
-#...
+# This function is used to generate all pattern change as
+# recursive list.
+# for example, for a [(1,3),(1,4),(1,5)] xy_couples,
+# it will generate a 60 item list with:
+# Rule: [1, '[1-5]', [1, '[1-4]', [1, '[1-3]', []]]]
+# Rule: [1, '[1-5]', [1, '[1-4]', [2, '[1-3]', []]]]
+# ...
 def got_generation_rule_patern_change(xy_couples):
     res = []
     xy_cpl = xy_couples
@@ -361,14 +361,14 @@ def got_generation_rule_patern_change(xy_couples):
     return res
 
 
-#this fuction apply a recursive patern change
-#generate by the got_generation_rule_patern_change
-#function.
-#It take one entry of this list, and apply
-#recursivly the change to s like :
-#s = "Unit [1-3] Port [1-4] Admin [1-5]"
-#rule = [1, '[1-5]', [2, '[1-4]', [3, '[1-3]', []]]]
-#output = Unit 3 Port 2 Admin 1
+# this fuction apply a recursive pattern change
+# generate by the got_generation_rule_patern_change
+# function.
+# It take one entry of this list, and apply
+# recursivly the change to s like :
+# s = "Unit [1-3] Port [1-4] Admin [1-5]"
+# rule = [1, '[1-5]', [2, '[1-4]', [3, '[1-3]', []]]]
+# output = Unit 3 Port 2 Admin 1
 def apply_change_recursive_patern_change(s, rule):
     #print "Try to change %s" % s, 'with', rule
     new_s = s
@@ -381,11 +381,11 @@ def apply_change_recursive_patern_change(s, rule):
     return apply_change_recursive_patern_change(s, t)
 
 
-#For service generator, get dict from a _custom properties
-#as _disks   C$(80%!90%),D$(80%!90%)$,E$(80%!90%)$
+# For service generator, get dict from a _custom properties
+# as _disks   C$(80%!90%),D$(80%!90%)$,E$(80%!90%)$
 #return {'C' : '80%!90%', 'D' : '80%!90%', 'E' : '80%!90%'}
-#And if we have a key that look like [X-Y] we will expand it
-#into Y-X+1 keys
+# And if we have a key that look like [X-Y] we will expand it
+# into Y-X+1 keys
 GET_KEY_VALUE_SEQUENCE_ERROR_NOERROR = 0
 GET_KEY_VALUE_SEQUENCE_ERROR_SYNTAX = 1
 GET_KEY_VALUE_SEQUENCE_ERROR_NODEFAULT = 2
@@ -439,14 +439,12 @@ def get_key_value_sequence(entry, default_value=None):
                 r['VALUE1'] = default_value
         r['VALUE'] = r['VALUE1']
 
-    #Now create new one but for [X-Y] matchs
-    # array1 holds the original entries. Some of the keys may contain wildcards
-    # array2 is filled with originals and inflated wildcards
-    #import time
-    #t0 = time.time()
-    #NodeSet = None
+    # Now create new one but for [X-Y] matchs
+    #  array1 holds the original entries. Some of the keys may contain wildcards
+    #  array2 is filled with originals and inflated wildcards
+    
     if NodeSet is None:
-        #The patern that will say if we have a [X-Y] key.
+        # The pattern that will say if we have a [X-Y] key.
         pat = re.compile('\[(\d*)-(\d*)\]')
 
     for r in array1:
@@ -454,28 +452,28 @@ def get_key_value_sequence(entry, default_value=None):
         key = r['KEY']
         orig_key = r['KEY']
 
-        #We have no choice, we cannot use NodeSet, so we use the
-        #simple regexp
+        # We have no choice, we cannot use NodeSet, so we use the
+        # simple regexp
         if NodeSet is None:
             m = pat.search(key)
             got_xy = (m is not None)
         else: # Try to look with a nodeset check directly
             try:
                 ns = NodeSet(str(key))
-                #If we have more than 1 element, we have a xy thing
+                # If we have more than 1 element, we have a xy thing
                 got_xy = (len(ns) != 1)
             except NodeSetParseRangeError:
                 return (None, GET_KEY_VALUE_SEQUENCE_ERROR_NODE)
                 pass # go in the next key
 
-        #Now we've got our couples of X-Y. If no void,
-        #we were with a "key generator"
+        # Now we've got our couples of X-Y. If no void,
+        # we were with a "key generator"
 
         if got_xy:
-            #Ok 2 cases : we have the NodeSet lib or not.
-            #if not, we use the dumb algo (quick, but manage less
-            #cases like /N or , in paterns)
-            if NodeSet is None: #us the old algo
+            # Ok 2 cases : we have the NodeSet lib or not.
+            # if not, we use the dumb algo (quick, but manage less
+            # cases like /N or , in patterns)
+            if NodeSet is None: # us the old algo
                 still_loop = True
                 xy_couples = [] # will get all X-Y couples
                 while still_loop:
@@ -484,18 +482,18 @@ def get_key_value_sequence(entry, default_value=None):
                         (x,y) = m.groups()
                         (x,y) = (int(x), int(y))
                         xy_couples.append((x,y))
-                        #We must search if we've gotother X-Y, so
-                        #we delete this one, and loop
+                        # We must search if we've gotother X-Y, so
+                        # we delete this one, and loop
                         key = key.replace('[%d-%d]' % (x,y), 'Z'*10)
                     else:#no more X-Y in it
                         still_loop = False
 
-                #Now we have our xy_couples, we can manage them
+                # Now we have our xy_couples, we can manage them
 
-                #We search all patern change rules
+                # We search all pattern change rules
                 rules = got_generation_rule_patern_change(xy_couples)
 
-                #Then we apply them all to get ours final keys
+                # Then we apply them all to get ours final keys
                 for rule in rules:
                     res = apply_change_recursive_patern_change(orig_key, rule)
                     new_r = {}
@@ -505,10 +503,10 @@ def get_key_value_sequence(entry, default_value=None):
                     array2.append(new_r)
 
             else:
-                #The key was just a generator, we can remove it
-                #keys_to_del.append(orig_key)
+                # The key was just a generator, we can remove it
+                # keys_to_del.append(orig_key)
 
-                #We search all patern change rules
+                # We search all pattern change rules
                 #rules = got_generation_rule_patern_change(xy_couples)
                 nodes_set = expand_xy_patern(orig_key)
                 new_keys = list(nodes_set)
diff --git a/shinken/worker.py b/shinken/worker.py
index 4f08239..a2ac9e9 100644
--- a/shinken/worker.py
+++ b/shinken/worker.py
@@ -1,31 +1,28 @@
 #!/usr/bin/env python
-#Copyright (C) 2009-2010 :
-#    Gabes Jean, naparuba at gmail.com
-#    Gerhard Lausser, Gerhard.Lausser at consol.de
-#    Gregory Starck, g.starck at gmail.com
-#    Hartmut Goebel, h.goebel at goebel-consult.de
+
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2009-2011 :
+#     Gabes Jean, naparuba at gmail.com
+#     Gerhard Lausser, Gerhard.Lausser at consol.de
+#     Gregory Starck, g.starck at gmail.com
+#     Hartmut Goebel, h.goebel at goebel-consult.de
 #
-#This file is part of Shinken.
+# This file is part of Shinken.
 #
-#Shinken is free software: you can redistribute it and/or modify
-#it under the terms of the GNU Affero General Public License as published by
-#the Free Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
+# Shinken is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-#Shinken is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#GNU Affero General Public License for more details.
+# Shinken is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#You should have received a copy of the GNU Affero General Public License
-#along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
-
+# You should have received a copy of the GNU Affero General Public License
+# along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
 
-#This class is used for poller and reactionner to work.
-#The worker is a process launch by theses process and read Message in a Queue
-#(self.s) (slave)
-#They launch the Check and then send the result in the Queue self.m (master)
-#they can die if they do not do anything (param timeout)
 
 from Queue import Empty
 
@@ -47,8 +44,15 @@ import sys
 import signal
 
 
-#Worker class
 class Worker:
+    """This class is used for poller and reactionner to work.
+    The worker is a process launch by theses process and read Message in a Queue
+    (self.s) (slave)
+    They launch the Check and then send the result in the Queue self.m (master)
+    they can die if they do not do anything (param timeout)
+
+    """
+
     id = 0#None
     _process = None
     _mortal = None
@@ -150,8 +154,8 @@ class Worker:
             return
 
 
-    #Launch checks that are in status
-    #REF: doc/shinken-action-queues.png (4)
+    # Launch checks that are in status
+    # REF: doc/shinken-action-queues.png (4)
     def launch_new_checks(self):
         #queue
         for chk in self.checks:
@@ -165,9 +169,9 @@ class Worker:
                     self.i_am_dying = True
 
 
-    #Check the status of checks
-    #if done, return message finished :)
-    #REF: doc/shinken-action-queues.png (5)
+    # Check the status of checks
+    # if done, return message finished :)
+    # REF: doc/shinken-action-queues.png (5)
     def manage_finished_checks(self):
         to_del = []
         wait_time = 1
@@ -176,51 +180,47 @@ class Worker:
             if action.status == 'launched' and action.last_poll < now - action.wait_time:
                 action.check_finished(self.max_plugins_output_length)
                 wait_time = min(wait_time, action.wait_time)
-                #If action done, we can launch a new one
+                # If action done, we can launch a new one
             if action.status in ('done', 'timeout'):
                 to_del.append(action)
-                #We answer to the master
+                # We answer to the master
                 #msg = Message(id=self.id, type='Result', data=action)
                 try:
                    self.returns_queue.put(action)
-                    # In android, the Queue is changed
-                   # if not is_android:
-                   #     self.returns_queue.append(action)
-                   # else:
-                   #     self.returns_queue.put(action)
+
                 except IOError , exp:
                     print "[%d]Exiting: %s" % (self.id, exp)
                     sys.exit(2)
-        #Little sleep
+        # Little sleep
         self.wait_time = wait_time
 
         for chk in to_del:
             self.checks.remove(chk)
 
-        #Little seep
+        # Little sleep
         time.sleep(wait_time)
 
 
-    #Check if our system time change. If so, change our
+    # Check if our system time change. If so, change our
     def check_for_system_time_change(self):
         now = time.time()
         difference = now - self.t_each_loop
 
-        #Now set the new value for the tick loop
+        # Now set the new value for the tick loop
         self.t_each_loop = now
 
-        #return the diff if it need, of just 0
+        # return the diff if it need, of just 0
         if abs(difference) > 900:
             return difference
         else:
             return 0
 
 
-    #id = id of the worker
-    #s = Global Queue Master->Slave
-    #m = Queue Slave->Master
-    #return_queue = queue managed by manager
-    #c = Control Queue for the worker
+    # id = id of the worker
+    # s = Global Queue Master->Slave
+    # m = Queue Slave->Master
+    # return_queue = queue managed by manager
+    # c = Control Queue for the worker
     def work(self, s, returns_queue, c):
         ## restore default signal handler for the workers:
         # but on android, we are a thread, so don't do it
@@ -239,32 +239,32 @@ class Worker:
             # If we are dying (big problem!) we do not
             # take new jobs, we just finished the current one
             if not self.i_am_dying:
-                #REF: doc/shinken-action-queues.png (3)
+                # REF: doc/shinken-action-queues.png (3)
                 self.get_new_checks()
-                #REF: doc/shinken-action-queues.png (4)
+                # REF: doc/shinken-action-queues.png (4)
                 self.launch_new_checks()
-            #REF: doc/shinken-action-queues.png (5)
+            # REF: doc/shinken-action-queues.png (5)
             self.manage_finished_checks()
 
-            #Now get order from master
+            # Now get order from master
             try:
                 cmsg = c.get(block=False)
                 if cmsg.get_type() == 'Die':
-                    print "[%d]Dad say we are dying..." % self.id
+                    print "Info : [%d]Dad say we are dying..." % self.id
                     break
             except :
                 pass
 
             if self._mortal == True and self._idletime > 2 * self._timeout:
-                print "[%d]Timeout, Harakiri" % self.id
-                #The master must be dead and we are loonely, we must die
+                print "Warning : [%d]Timeout, Harakiri" % self.id
+                # The master must be dead and we are lonely, we must die
                 break
 
             # Look if we are dying, and if we finishe all current checks
             # if so, we really die, our master poller will launch a new
             # worker because we were too weack to manage our job :(
             if len(self.checks) == 0 and self.i_am_dying:
-                print "[%d] I DIE because I cannot do my job as I should (too many open files?)... forgot me please." % self.id
+                print "Warning : [%d] I DIE because I cannot do my job as I should (too many open files?)... forgot me please." % self.id
                 break
 
             # Manage a possible time change (our avant will be change with the diff)

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list