Example #1
0
 def __init__(self, context):
     self.bus = None
     try:
         self.upstart = UpstartSystem()
     except:
         self.bus = DirectUpstartBus()
         self.upstart = UpstartSystem(bus=self.bus)
Example #2
0
 def __verify__(cls):
     try:
         UpstartSystem()
         return True
     except:
         try:
             UpstartSystem(bus=DirectUpstartBus())
             return True
         except:
             return False
Example #3
0
    def __verify__(cls):
        """
        Test if upstart system is used.

        :return: Response from Python module upstart.
        :rtype: bool
        """

        try:
            UpstartSystem()
            return True
        except Exception as e:
            try:
                UpstartSystem(bus=DirectUpstartBus())
                return True
            except Exception as e:
                return False
Example #4
0
def test_system():
    from upstart.system import UpstartSystem

    s = UpstartSystem()

    print("Version: %s" % (s.get_version()))

    current_priority = s.get_log_priority()
    print("Current priority: %s" % (current_priority))

    new_priority = 'debug'
    s.set_log_priority(new_priority)

    updated_priority = s.get_log_priority()
    print("Updated priority: %s" % (updated_priority))

    s.set_log_priority(current_priority)

    restored_priority = s.get_log_priority()
    print("Restored priority: %s" % (restored_priority))

    #    print(list(s.get_all_jobs()))
    s.emit('foo', {'aa': 55})