def get_value(self, config): for mgr in ServiceManager.all(self.context): if mgr.id == config.get('manager_id', None): svc = mgr.get(config.get('service_id', None)) return { 'id': svc.id, 'name': svc.name, 'managerId': svc.manager.id, 'state': svc.state, 'isRunning': svc.running, }
def get_value(self, config): manager_id = config.get('manager_id', None) service_id = config.get('service_id', None) if not manager_id or not service_id: return None for mgr in ServiceManager.all(self.context): if mgr.id == manager_id: svc = mgr.get_service(service_id) return { 'id': svc.id, 'name': svc.name, 'managerId': svc.manager.id, 'state': svc.state, 'isRunning': svc.running, }
def __init__(self, context): self.context = context self.managers = dict( (x.id, x) for x in ServiceManager.all(self.context))
def __init__(self, context): self.context = context self.managers = {x.id: x for x in ServiceManager.all(self.context)}
def __init__(self, context): self.context = context self.managers = dict((x.id, x) for x in ServiceManager.all(self.context))