def detail(self, request, service): """Detailed view of a single service.""" service_ref = { 'service': { 'id': service.get('id'), 'binary': service.get('binary'), 'host': service.get('host'), 'status': 'disabled' if service.get('disabled') else 'enabled', 'state': 'up' if utils.service_is_up(service) else 'down', 'updated_at': service.get('updated_at'), 'disabled_reason': service.get('disabled_reason') } } return service_ref
def list(self): """Show a list of all karbor services.""" ctxt = context.get_admin_context() services = db.service_get_all(ctxt) print_format = "%-16s %-36s %-10s %-5s %-10s" print( print_format % (_('Binary'), _('Host'), _('Status'), _('State'), _('Updated At'))) for svc in services: alive = utils.service_is_up(svc) art = ":-)" if alive else "XXX" status = 'enabled' if svc['disabled']: status = 'disabled' print(print_format % (svc['binary'], svc['host'].partition('.')[0], status, art, svc['updated_at']))
def list(self): """Show a list of all karbor services.""" ctxt = context.get_admin_context() services = db.service_get_all(ctxt) print_format = "%-16s %-36s %-10s %-5s %-10s" print(print_format % (_('Binary'), _('Host'), _('Status'), _('State'), _('Updated At'))) for svc in services: alive = utils.service_is_up(svc) art = ":-)" if alive else "XXX" status = 'enabled' if svc['disabled']: status = 'disabled' print(print_format % (svc['binary'], svc['host'].partition('.')[0], status, art, svc['updated_at']))