def service_list(self): services = [ self._format_service(service) for service in api.service_get_all(self.ctx) ] print_format = "%-36s %-24s %-16s %-16s %-10s %-24s %-24s" print(print_format % (_('Service ID'), _('Host'), _('Binary'), _('Topic'), _('Status'), _('Created At'), _('Updated At'))) for svc in services: print(print_format % (svc['service_id'], svc['host'], svc['binary'], svc['topic'], svc['status'], svc['created_at'], svc['updated_at']))
def service_list(self): services = [self._format_service(service) for service in api.service_get_all(self.ctx)] print_format = "%-36s %-24s %-16s %-16s %-10s %-24s %-24s" print(print_format % (_('Service ID'), _('Host'), _('Binary'), _('Topic'), _('Status'), _('Created At'), _('Updated At'))) for svc in services: print(print_format % (svc['service_id'], svc['host'], svc['binary'], svc['topic'], svc['status'], svc['created_at'], svc['updated_at']))
def get_all(cls, context): objs = db_api.service_get_all(context) return [cls._from_db_object(context, cls(), obj) for obj in objs]
def service_clean(self): for service in api.service_get_all(self.ctx): svc = self._format_service(service) if svc['status'] == 'down': print(_('Dead service %s is removed.') % svc['service_id']) api.service_delete(self.ctx, svc['service_id'])