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

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


The following commit has been merged in the debian/master branch:
commit 76e47a10603e9e746073f555c324f32b045deca0
Author: Sebastien Coavoux <s.coavoux at free.fr>
Date:   Fri Jan 27 12:06:03 2012 +0100

    Code Review.
    Fixed : typo in comments
    Fixed : misplaced comments
    Updated : licence in files
    Added : # -*- coding: utf-8 -*- in header
    Added : Suggestion in a property.py (not very important)
    
    Personal Note :
    *None
    
    Feel free to (dis)agree

diff --git a/shinken/modulesmanager.py b/shinken/modulesmanager.py
index 58ac1b3..32dc486 100644
--- a/shinken/modulesmanager.py
+++ b/shinken/modulesmanager.py
@@ -1,27 +1,29 @@
 #!/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 use to manage modules and call callback
 
 import os
 import time
@@ -33,7 +35,9 @@ from shinken.basemodule import BaseModule
 from shinken.log import logger
 
 class ModulesManager(object):
-
+    """This class is use to manage modules and call callback"""
+    
+    
     def __init__(self, modules_type, modules_path, modules):
         self.modules_path = modules_path
         self.modules_type = modules_type
@@ -51,8 +55,8 @@ class ModulesManager(object):
         self.manager = manager
 
 
+    # Set the modules requested for this manager
     def set_modules(self, modules):
-        """ Set the modules requested for this manager """
         self.modules = modules
         self.allowed_types = [ mod.module_type for mod in modules ]
 
@@ -61,16 +65,16 @@ class ModulesManager(object):
         self.max_queue_size = max_queue_size
 
 
+    # Import, instanciate & "init" the modules we have been requested
     def load_and_init(self):
-        """ Import, instanciate & "init" the modules we have been requested """
         self.load()
         self.get_instances()
 
 
+    # Try to import the requested modules ; put the imported modules in self.imported_modules.
+    # The previous imported modules, if any, are cleaned before.
     def load(self):
         now = int(time.time())
-        """ Try to import the requested modules ; put the imported modules in self.imported_modules.
-The previous imported modules, if any, are cleaned before. """ 
         # We get all modules file with .py
         modules_files = [ fname[:-3] for fname in os.listdir(self.modules_path) 
                          if fname.endswith(".py") ]
@@ -114,9 +118,9 @@ The previous imported modules, if any, are cleaned before. """
                 logger.log("Warning : the module type %s for %s was not found in modules!" % (module_type, mod_conf.get_name()))
 
 
+    # Try to "init" the given module instance. 
+    # Returns: True on successfull init. False if instance init method raised any Exception.
     def try_instance_init(self, inst):
-        """ Try to "init" the given module instance. 
-Returns: True on successfull init. False if instance init method raised any Exception. """ 
         try:
             logger.log("Trying to init module : %s" % inst.get_name())
             inst.init_try += 1
@@ -141,9 +145,8 @@ Returns: True on successfull init. False if instance init method raised any Exce
             return False
         return True
 
-
+    # Request to "remove" the given instances list or all if not provided
     def clear_instances(self, insts=None):
-        """ Request to "remove" the given instances list or all if not provided """
         if insts is None:
             insts = self.instances[:] # have to make a copy of the list
         for i in insts:
@@ -157,16 +160,16 @@ Returns: True on successfull init. False if instance init method raised any Exce
 
 
     # actually only arbiter call this method with start_external=False..
+    # Create, init and then returns the list of module instances that the caller needs.
+    # If an instance can't be created or init'ed then only log is done. 
+    # That instance is skipped. The previous modules instance(s), if any, are all cleaned.
     def get_instances(self):
-        """ Create, init and then returns the list of module instances that the caller needs.
-If an instance can't be created or init'ed then only log is done. That instance is skipped.
-The previous modules instance(s), if any, are all cleaned. """ 
         self.clear_instances()
         for (mod_conf, module) in self.modules_assoc:
             try:
                 mod_conf.properties = module.properties.copy()
                 inst = module.get_instance(mod_conf)
-                if inst is None: #None = Bad thing happened :)
+                if inst is None: # None = Bad thing happened :)
                     logger.log("get_instance for module %s returned None !" % (mod_conf.get_name()))
                     continue
                 assert(isinstance(inst, BaseModule))
@@ -201,20 +204,20 @@ The previous modules instance(s), if any, are all cleaned. """
                 continue
             
             # ok, init succeed
-            logger.log("Starting external module %s" % inst.get_name())
+            logger.log("Info : Starting external module %s" % inst.get_name())
             inst.start()
 
 
 
-     
+    # Request to cleanly remove the given instance. 
+    # If instance is external also shutdown it cleanly 
     def remove_instance(self, inst):
-        """ Request to cleanly remove the given instance. 
-If instance is external also shutdown it cleanly """
+
         # External instances need to be close before (process + queues)
         if inst.is_external:
-            print "Ask stop process for", inst.get_name()
+            print "Info : Ask stop process for", inst.get_name()
             inst.stop_process()
-            print "Stop process done"
+            print "Info : Stop process done"
         
         inst.clear_queues(self.manager)
 
@@ -223,64 +226,18 @@ If instance is external also shutdown it cleanly """
 
 
     def check_alive_instances(self):
-        #Only for external
+        # Only for external
         for inst in self.instances:
             if not inst in self.to_restart:
                 if inst.is_external and not inst.process.is_alive():
                     logger.log("Error : the external module %s goes down unexpectly!" % inst.get_name())
-                    logger.log("Setting the module %s to restart" % inst.get_name())
+                    logger.log("Info : Setting the module %s to restart" % inst.get_name())
                     # We clean its queues, they are no more useful
                     inst.clear_queues(self.manager)
                     self.to_restart.append(inst)
                     # Ok, no need to look at queue size now
                     continue
 
-                # Maybe the thread's queue of the module got a problem
-                # if so, restart this module
-#                if inst.to_q is not None:
-#                    thr = inst.to_q._thread
-#                    if thr is not None and not thr.is_alive():
-                        # Ok, it's nevera good idea to call a _function, especially
-                        # this one. But we must be sure we do not let the die thread
-#                        try:
-#                            thr._jointhread()
-#                        except Exception, exp:
-#                            print "_jointhread exception :", exp
-                        # Set this queue to start a new thread
-#                        logger.log("Error : the external module %s got a Thread/queue problem!" % inst.get_name())
-#                        inst.to_q._thread = None
-                        
-
-#                        logger.log("Error : the external module %s got a Thread/queue problem!" % inst.get_name())
-#                        logger.log("Setting the module %s to restart" % inst.get_name())
-#                        # We clean its queues, they are no more useful
-#                        inst.clear_queues()
-#                        self.to_restart.append(inst)
-#                        # Ok, no need to look at queue size now
-#                        continue
-
-                # Same for from_q
-#                if inst.from_q is not None:
-#                    thr = inst.from_q._thread
-#                    if thr is not None and not thr.is_alive():
-                        # Ok, it's nevera good idea to call a _function, especially
-                        # this one. But we must be sure we do not let the die thread
-#                        try:
-#                            thr._jointhread()
-#                        except Exception, exp:
-#                            print "_jointhread exception :", exp
-                        # Set this queue to start a new thread
-#                        logger.log("Error : the external module %s got a Thread/queue problem!" % inst.get_name())
-#                        inst.from_q._thread = None
-#                        logger.log("Error : the external module %s got a Thread/queue problem!" % inst.get_name())
-#                        logger.log("Setting the module %s to restart" % inst.get_name())
-#                        # We clean its queues, they are no more useful
-#                        inst.clear_queues()
-#                        self.to_restart.append(inst)
-#                        # Ok, no need to look at queue size now
-#                        continue
-
-
                 # Now look for man queue size. If above value, the module should got a huge problem
                 # and so bailout. It's not a perfect solution, more a watchdog
                 # If max_queue_size is 0, don't check this
@@ -294,7 +251,7 @@ If instance is external also shutdown it cleanly """
                     pass
                 if queue_size > self.max_queue_size:
                     logger.log("Error : the external module %s got a too high brok queue size (%s > %s)!" % (inst.get_name(), queue_size, self.max_queue_size))
-                    logger.log("Setting the module %s to restart" % inst.get_name())
+                    logger.log("Info : Setting the module %s to restart" % inst.get_name())
                     # We clean its queues, they are no more useful
                     inst.clear_queues(self.manager)
                     self.to_restart.append(inst)
@@ -307,9 +264,9 @@ If instance is external also shutdown it cleanly """
         to_restart = self.to_restart[:]
         del self.to_restart[:]
         for inst in to_restart:
-            print "I should try to reinit", inst.get_name()
+            print "Info : I should try to reinit", inst.get_name()
             if self.try_instance_init(inst):
-                print "Good, I try to restart",  inst.get_name()
+                print "Info : Good, I try to restart",  inst.get_name()
                 # If it's an external, it will start it
                 inst.start()
                 # Ok it's good now :)
diff --git a/shinken/notification.py b/shinken/notification.py
index d2d55f9..ae1533e 100644
--- a/shinken/notification.py
+++ b/shinken/notification.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
@@ -29,14 +32,14 @@ from shinken.property import BoolProp, IntegerProp, StringProp
 from shinken.autoslots import AutoSlots
 
 class Notification(Action):
+    """Please Add a Docstring to describe the class here"""
+    
     # AutoSlots create the __slots__ with properties and
     # running_properties names
     __metaclass__ = AutoSlots
 
     my_type = 'notification'
 
-    #id = 0 #Is in fact in the Action class to be common with Checks and
-    #events handlers
 
     properties = {
         'is_a' :               StringProp (default='notification'),
@@ -147,10 +150,10 @@ class Notification(Action):
         self.reactionner_tag = reactionner_tag
 
 
-    #return a copy of the check but just what is important for execution
-    #So we remove the ref and all
+    # return a copy of the check but just what is important for execution
+    # So we remove the ref and all
     def copy_shell(self):
-        #We create a dummy check with nothing in it, just defaults values
+        # We create a dummy check with nothing in it, just defaults values
         return self.copy_shell__( Notification('', '', '', '', '', '', '', id=self.id) )
 
 
@@ -167,7 +170,6 @@ class Notification(Action):
 
     def __str__(self):
         return "Notification %d status:%s command:%s ref:%s t_to_go:%s" % (self.id, self.status, self.command, self.ref, time.asctime(time.localtime(self.t_to_go)))
-        #return ''#str(self.__dict__)
 
 
     def get_id(self):
@@ -191,7 +193,7 @@ class Notification(Action):
                 data[prop] = getattr(self, prop)
 
 
-    #Get a brok with initial status
+    # Get a brok with initial status
     def get_initial_status_brok(self):
         data = {'id': self.id}
 
@@ -200,8 +202,8 @@ class Notification(Action):
         return b
 
 
-    #Call by picle for dataify the coment
-    #because we DO NOT WANT REF in this pickleisation!
+    # Call by pickle for dataify the comment
+    # because we DO NOT WANT REF in this pickleisation!
     def __getstate__(self):
         cls = self.__class__
         # id is not in *_properties
@@ -213,7 +215,7 @@ class Notification(Action):
         return res
 
 
-    # Inversed funtion of getstate
+    # Inverted funtion of getstate
     def __setstate__(self, state):
         cls = self.__class__
         self.id = state['id']
diff --git a/shinken/pollerlink.py b/shinken/pollerlink.py
index 1c219ea..6188c11 100644
--- a/shinken/pollerlink.py
+++ b/shinken/pollerlink.py
@@ -1,36 +1,42 @@
 #!/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 the link between Arbiter and Poller. With It, arbiter
-#can see if a poller is alive, and can send it new configuration
 
 from shinken.satellitelink import SatelliteLink, SatelliteLinks
 from shinken.property import BoolProp, IntegerProp, StringProp, ListProp
 
 class PollerLink(SatelliteLink):
+    """This class is the link between Arbiter and Poller. With it, arbiter
+    can see if a poller is alive, and can send it new configuration
+    
+    """
+    
     id = 0
     my_type = 'poller'
-    #To_send : send or not to satellite conf
+    # To_send : send or not to satellite conf
     properties = SatelliteLink.properties.copy()
     properties.update({
         'poller_name':  StringProp(fill_brok=['full_status'], to_send=True),
@@ -50,5 +56,7 @@ class PollerLink(SatelliteLink):
         self.realm.pollers.append(self)
 
 class PollerLinks(SatelliteLinks):
+    """Please Add a Docstring to describe the class here"""
+    
     name_property = "poller_name"
     inner_class = PollerLink
diff --git a/shinken/property.py b/shinken/property.py
index 7b870ca..6a83917 100644
--- a/shinken/property.py
+++ b/shinken/property.py
@@ -1,11 +1,10 @@
 # -*- mode: python ; coding: utf-8 -*-
-#
-# Copyright (C) 2010-2011:
-#    Hartmut Goebel, h.goebel at goebel-consult.de
-#    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
+
+# 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.
 #
@@ -21,8 +20,8 @@
 #
 # You should have received a copy of the GNU Affero General Public License
 # along with Shinken.  If not, see <http://www.gnu.org/licenses/>.
-"""
-"""
+
+
 
 from shinken.util import to_float, to_split, to_char, to_int
 
@@ -30,6 +29,8 @@ __all__ = ['UnusedProp', 'BoolProp', 'IntegerProp', 'FloatProp',
            'CharProp', 'StringProp', 'ListProp',
            'FULL_STATUS', 'CHECK_RESULT']
 
+# Suggestion 
+# Is this useful? see above
 __author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
 __copyright__ = "Copyright 2010-2011 by Hartmut Goebel <h.goebel at goebel-consult.de>"
 __licence__ = "GNU Affero General Public License version 3 (AGPL v3)"
@@ -43,19 +44,22 @@ none_object = object()
 
 
 class Property(object):
-    """
-    Baseclass of all properties.
+    """Baseclass of all properties.
 
     Same semantic for all subclasses (except UnusedProp): The property
     is required if, and only if, the default value is `None`.
 
 
     """
+    
+    
+    
     def __init__(self, default=none_object, class_inherit=None,
                  unmanaged=False, help='', no_slots=False,
                  fill_brok=None, conf_send_preparation=None,
                  brok_transformation=None,retention=False,to_send=False,
                  override=False,managed=True):
+                     
         """
         `default`: default value to be used if this property is not set.
                    If default is None, this property is requied.
@@ -90,6 +94,7 @@ class Property(object):
         managed : property that is managed in Nagios but not in Shinken
 
         """
+        
         self.default = default
         self.has_default = (default is not none_object)
         self.required = not self.has_default
@@ -108,21 +113,20 @@ class Property(object):
 
 
 class UnusedProp(Property):
-    """
-    A unused Property. These are typically used by Nagios but
+    """A unused Property. These are typically used by Nagios but
     no longer usefull/used by Shinken.
 
     This is just to warn the user that the option he use is no more used
     in Shinken.
+    
     """
+    
+    # Since this property is not used, there is no use for other
+    # parameters than 'text'.
+    # 'text' a some usage text if present, will print it to explain
+    # why it's no more useful
     def __init__(self, text=None):
-        """
-        Since this property is not used, there is no use for other
-        parameters than `text`.
 
-        `text` a some usage text if present, will print it to explain
-        why it's no more useful
-        """
         if text is None:
             text = ("This parameter is no longer useful in the "
                     "Shinken architecture.")
@@ -138,8 +142,7 @@ _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True,
 
 
 class BoolProp(Property):
-    """
-    A Boolean Property.
+    """A Boolean Property.
 
     Boolean values are currently case insensitively defined as 0,
     false, no, off for False, and 1, true, yes, on for True).
@@ -150,24 +153,28 @@ class BoolProp(Property):
 
 
 class IntegerProp(Property):
+    """Please Add a Docstring to describe the class here"""
 #    @staticmethod
     def pythonize(self, val):
         return to_int(val)
 
 
 class FloatProp(Property):
+    """Please Add a Docstring to describe the class here"""
 #    @staticmethod
     def pythonize(self, val):
         return to_float(val)
 
 
 class CharProp(Property):
+    """Please Add a Docstring to describe the class here"""
 #    @staticmethod
     def pythonize(self, val):
         return to_char(val)
 
 
 class StringProp(Property):
+    """Please Add a Docstring to describe the class here"""
 #    @staticmethod
     def pythonize(self, val):
         return val
@@ -179,6 +186,7 @@ class ConfigPathProp(StringProp):
     """ A string property representing a config file path """
 
 class ListProp(Property):
+    """Please Add a Docstring to describe the class here"""
 #    @staticmethod
     def pythonize(self, val):
         return to_split(val)
diff --git a/shinken/pyro_wrapper.py b/shinken/pyro_wrapper.py
index d2b794f..559b830 100644
--- a/shinken/pyro_wrapper.py
+++ b/shinken/pyro_wrapper.py
@@ -1,28 +1,29 @@
 #!/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 a wrapper for managing Pyro 3 and 4 version
-
 import select
 import errno
 import time
@@ -36,6 +37,8 @@ except ImportError: #ok, no Pyro3, maybe 4
     import Pyro4 as Pyro
 
 
+
+""" This class is a wrapper for managing Pyro 3 and 4 version """
 class InvalidWorkDir(Exception): pass
 class PortNotFree(Exception): pass
 
@@ -68,7 +71,7 @@ try:
             else:
                 prtcol = 'PYRO'
 
-            print "Initializing Pyro connection with host:%s port:%s ssl:%s" % (host, port, use_ssl)
+            print "Info : Initializing Pyro connection with host:%s port:%s ssl:%s" % (host, port, use_ssl)
             # Now the real start
             try:
                 Pyro.core.Daemon.__init__(self, host=host, port=port, prtcol=prtcol, norange=True)
@@ -76,7 +79,7 @@ try:
                 # must be problem with workdir :
                 raise InvalidWorkDir(e)
             except Pyro.errors.DaemonError, e:
-                msg = "Sorry, the port %d is not free: %s" % (port, e)
+                msg = "Error : Sorry, the port %d is not free: %s" % (port, e)
                 raise PortNotFree(msg)
 
         def register(self, obj, name):
@@ -95,7 +98,7 @@ try:
             try:
                 Pyro.core.Daemon.handleRequests(self)    
             # Sometime Pyro send us xml pickling implementation (gnosis) is not available
-            #and I don't know why... :(
+            # and I don't know why... :(
             except NotImplementedError:
                 pass
                 
@@ -147,10 +150,10 @@ except AttributeError, exp:
 
         
         def __init__(self, host, port, use_ssl=False):
-            # Pyro 4 i by default thread, should do select
+            # Pyro 4 is by default a thread, should do select
             # (I hate threads!)
             # And of course the name changed since 4.5...
-            # Since them, we got a better sock reuse, so
+            # Since then, we got a better sock reuse, so
             # before 4.5 we must wait 35 s for the port to stop
             # and in >=4.5 we can use REUSE socket :)
             max_try = 35
@@ -169,21 +172,21 @@ except AttributeError, exp:
             # timewait for close sockets)
             while nb_try < max_try:
                 nb_try += 1
-                print "Initializing Pyro connection with host:%s port:%s ssl:%s" % (host, port, use_ssl)
+                print "Info : Initializing Pyro connection with host:%s port:%s ssl:%s" % (host, port, use_ssl)
                 # And port already use now raise an exception
                 try:
                     Pyro.core.Daemon.__init__(self, host=host, port=port)
                     # Ok, we got our daemon, we can exit
                     break
                 except socket.error, exp:
-                    msg = "Sorry, the port %d is not free : %s" % (port, str(exp))
+                    msg = "Error : Sorry, the port %d is not free : %s" % (port, str(exp))
                     # At 35 (or over), we are very not happy
                     if nb_try >= max_try:
                         raise PortNotFree(msg)
                     print msg, "but we try another time in 1 sec"
                     time.sleep(1)
                 except Exception, e:
-                    # must be problem with pyro workdir :
+                    # must be a problem with pyro workdir :
                     raise InvalidWorkDir(e)
 
 
@@ -223,6 +226,7 @@ except AttributeError, exp:
 
 
 class ShinkenPyroDaemon(PyroClass):
+    """Please Add a Docstring to describe the class here"""
     
     def get_socks_activity(self, timeout):
         try:
diff --git a/shinken/reactionnerlink.py b/shinken/reactionnerlink.py
index 0bdb8d4..9d0ffab 100644
--- a/shinken/reactionnerlink.py
+++ b/shinken/reactionnerlink.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/>.
 
 
 from shinken.satellitelink import SatelliteLink, SatelliteLinks
@@ -26,6 +29,9 @@ from shinken.property import BoolProp, IntegerProp, StringProp, ListProp
 
 
 class ReactionnerLink(SatelliteLink):
+    """Please Add a Docstring to describe the class here"""
+    
+    
     id = 0
     my_type = 'reactionner'
     properties = SatelliteLink.properties.copy()
@@ -49,5 +55,7 @@ class ReactionnerLink(SatelliteLink):
 
 
 class ReactionnerLinks(SatelliteLinks):#(Items):
+    """Please Add a Docstring to describe the class here"""
+    
     name_property = "reactionner_name"
     inner_class = ReactionnerLink
diff --git a/shinken/receiverlink.py b/shinken/receiverlink.py
index 728e686..73fd287 100644
--- a/shinken/receiverlink.py
+++ b/shinken/receiverlink.py
@@ -1,30 +1,35 @@
 #!/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/>.
 
 
 from shinken.satellitelink import SatelliteLink, SatelliteLinks
 from shinken.property import BoolProp, IntegerProp, StringProp, ListProp
 
 class ReceiverLink(SatelliteLink):
+    """Please Add a Docstring to describe the class here"""
+    
     id = 0
     my_type = 'receiver'
     properties = SatelliteLink.properties.copy()
@@ -46,5 +51,7 @@ class ReceiverLink(SatelliteLink):
 
 
 class ReceiverLinks(SatelliteLinks):
+    """Please Add a Docstring to describe the class here"""
+    
     name_property = "receiver_name"
     inner_class = ReceiverLink

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list