Ejemplo n.º 1
0
 def get(self, _id):
     job = UpstartJob(_id, bus=self.bus)
     svc = Service(self)
     svc.id = _id
     svc.name = self.__fix_name(_id)
     try:
         svc.state = job.get_status()['state']
         svc.running = svc.state == 'running'
     except:
         svc.running = False
     return svc
Ejemplo n.º 2
0
    def stop(self, _id):
        """
        Basically stop a job.

        :param _id: job name
        :type _id: string
        """

        try:
            UpstartJob(_id).stop()
        except DBusException as e:
            raise ServiceOperationError(e)
Ejemplo n.º 3
0
    def get_service(self, _id):
        """
        Get informations from module upstart for one specified job.

        :param _id: Job name
        :type _id: string
        :return: Service object
        :rtype: Service
        """

        job = UpstartJob(_id, bus=self.bus)
        svc = Service(self)
        svc.id = _id
        svc.name = self.__fix_name(_id)
        try:
            svc.state = job.get_status()['state']
            svc.running = svc.state == 'running'
        except Exception as e:
            svc.running = False
        return svc
Ejemplo n.º 4
0
 def restart(self, _id):
     UpstartJob(_id).restart()
Ejemplo n.º 5
0
 def stop(self, _id):
     UpstartJob(_id).stop()
Ejemplo n.º 6
0
 def start(self, _id):
     UpstartJob(_id).start()
Ejemplo n.º 7
0
 def restart(self, _id):
     try:
         UpstartJob(_id).restart()
     except DBusException as e:
         raise ServiceOperationError(e)