Changeset 5534


Ignore:
Timestamp:
Jul 14, 2017, 7:22:28 PM (23 months ago)
Author:
hectorgh
Message:

making sure SHUTDOWN var is read at boot time

Location:
n4d-shutdowner-client/trunk/fuentes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • n4d-shutdowner-client/trunk/fuentes/debian/changelog

    r5533 r5534  
     1n4d-shutdowner-client (0.3.2) xenial; urgency=high
     2
     3  * Making sure SHUTDOWN var is read at boot time.
     4
     5 -- Hector Garcia Huerta <hectorgh@gmail.com>  Fri, 14 Jul 2017 19:20:59 +0200
     6
    17n4d-shutdowner-client (0.3.1) xenial; urgency=high
    28
  • n4d-shutdowner-client/trunk/fuentes/install-files/usr/share/n4d/python-plugins/ShutdownerClient.py

    r5533 r5534  
    11import os
    22import threading
     3import time
    34
    45
     
    2122        def _startup(self):
    2223               
    23                 # Somehow, until I understand why, remote variables are only readable via threads
     24                objects["VariablesManager"].register_trigger("SHUTDOWNER","ShutdownerClient",self.shutdowner_trigger)
    2425               
    25                 self.shutdowner_var=objects["VariablesManager"].get_variable("SHUTDOWNER")
    26                 self.shutdowner_trigger(self.shutdowner_var)
    27                 objects["VariablesManager"].register_trigger("SHUTDOWNER","ShutdownerClient",self.shutdowner_trigger)
     26                # Making sure we're able to read SHUTDOWNER var from server
     27                tries=10
     28                for x in range(0,tries):
     29               
     30                        self.shutdowner_var=objects["VariablesManager"].get_variable("SHUTDOWNER")
     31                        if self.shutdowner_var != None:
     32                                self.shutdowner_trigger(self.shutdowner_var)
     33                                break
     34                        else:
     35                                time.sleep(1)
     36                               
     37                if self.shutdowner_var == None:
     38                        self.shutdowner_var={}
     39                        self.shutdowner_var["shutdown_signal"]=0
    2840               
    2941        #def startup
Note: See TracChangeset for help on using the changeset viewer.