Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37547310
en ru br
ALT Linux repositórios
S:2.8.0-alt2
5.0: 2.0.5-alt3.1
4.1: 2.0.5-alt3
4.0: 2.0.5-alt2
3.0: 2.0.2-alt1

Group :: Sistema/Servidores
RPM: nut

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: nut-2.8.0-unreachable.patch
Download


diff -up nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable nut-2.6.5/scripts/python/app/NUT-Monitor-py2gtk2.in
--- nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable	2012-07-31 19:38:56.000000000 +0200
+++ nut-2.6.5/scripts/python/app/NUT-Monitor-py2gtk2.in	2013-01-07 18:04:26.532531441 +0100
@@ -674,6 +674,11 @@ class interface :
             self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" )
             return
 
+        if not self.__ups_handler.CheckUPSAvailable( self.__current_ups ): 
+            self.gui_status_message( _("UPS '{0}' is not reachable").format( self.__current_ups ) )
+            self.gui_status_notification( _("UPS '{0}' is not reachable").format( self.__current_ups ), "warning.png" )
+            return
+
         self.__connected = True
         self.__widgets["ups_connect"].hide()
         self.__widgets["ups_disconnect"].show()
diff -up nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable nut-2.6.5/scripts/python/app/NUT-Monitor-py3qt5.in
--- nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable	2012-07-31 19:38:56.000000000 +0200
+++ nut-2.6.5/scripts/python/app/NUT-Monitor-py3qt5.in	2013-01-07 18:04:26.532531441 +0100
@@ -674,6 +674,11 @@ class interface :
             self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" )
             return
+        if not self.__ups_handler.CheckUPSAvailable( self.__current_ups ):
+            self.gui_status_message( _("UPS '{0}' is not reachable").format( self.__current_ups ) )
+            self.gui_status_notification( _("UPS '{0}' is not reachable").format( self.__current_ups ), "warning.png" )
+            return
+
         self.__connected = True
         self.__widgets["ups_connect"].hide()
         self.__widgets["ups_disconnect"].show()
diff -up nut-2.6.5/scripts/python/module/PyNUT.py.unreachable nut-2.6.5/scripts/python/module/PyNUT.py.in
--- nut-2.6.5/scripts/python/module/PyNUT.py.unreachable	2012-07-31 19:38:56.000000000 +0200
+++ nut-2.6.5/scripts/python/module/PyNUT.py.in	2013-01-07 17:41:26.548440712 +0100
@@ -158,6 +158,20 @@ available vars.
 
         return( ups_vars )
 
+    def CheckUPSAvailable( self, ups="") :
+        """ Check whether UPS is reachable
+
+Just tries to contact UPS with safe command.
+The result is True (rechable) or False (unreachable)
+        """
+        self.__srv_handler.write( "LIST CMD %s\n" % ups )
+        result = self.__srv_handler.read_until( "\n" )
+        if result != "BEGIN LIST CMD %s\n" % ups :
+            return False
+
+        self.__srv_handler.read_until( "END LIST CMD %s\n" % ups )
+        return True
+
     def GetUPSCommands( self, ups="" ) :
         """ Get all available commands for the specified UPS
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009