def do_service(options): if options['--start-all']: start_all_services() elif options['--start']: _service = service.get(options['--start']) _service._start() elif options['--stop-all']: stop_all_services() elif options['--stop']: _service = service.get(options['--stop']) _service._stop() elif options['--restart-all']: restart_all_services() elif options['--restart']: _service = service.get(options['--restart']) _service._restart() elif options['--running']: for _service in service.list_running_services(): print _service elif options['--list']: for _service in service.store.find(Service)(): print _service.name else: print 'do nothing.'
def get(self): services = store.find(Service) runnings = service.list_running_services() self.render('index.html', services=services, runnings=runnings)