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
def get_service(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
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