Пример #1
0
 def on_start(self):
     # clear up previous manifest if any
     message = Message(self)
     message.recipient = "*/*"
     message.command = "MANIFEST"
     message.args = self.manifest["package"]
     message.set_null()
     message.retain = True
     self.send(message)
     # publish the new manifest
     message = Message(self)
     message.recipient = "*/*"
     message.command = "MANIFEST"
     message.args = self.manifest["package"]
     message.set_data(self.manifest)
     message.retain = True
     self.send(message)
     # start all the requested modules
     for entry in self.modules:
         self.start_module(entry)
         self.sleep(0.1)
     self.sleep(60)
     # loop forever
     while True:
         self.sleep(10)
Пример #2
0
 def on_stop(self):
     # remove the manifest
     message = Message(self)
     message.recipient = "*/*"
     message.command = "MANIFEST"
     message.args = self.manifest["package"]
     message.set_null()
     message.retain = True
     self.send(message)
Пример #3
0
 def clear_config(self, filename, version):
     # send a null so to cancel retention
     if filename != self.index_key: 
         self.log_debug("Unpublishing configuration "+filename+" (v"+str(version)+")")
     message = Message(self)
     message.recipient = "*/*"
     message.command = "CONF"
     message.args = filename
     message.config_schema = version
     # remove the retained message
     message.set_null()
     message.retain = True
     self.send(message)