def restart_services(self): srv_manager = service.ServiceManager() for srv in self.services: srv_manager.restart(srv) for srv in self.services: if not srv_manager.status(srv): if service.get_name_of_init() == 'systemd': process.run('journalctl -xe', ignore_status=True, verbose=True) e_msg = ('Failed to restart service %s ' '(see logs for details)' % srv) raise RestartServiceError(e_msg)
def stop_services(self): srv_manager = service.ServiceManager() for srv in reversed(self.services): srv_manager.stop(srv) for srv in self.services: if srv_manager.status(srv): if service.get_name_of_init() == 'systemd': process.run('journalctl -xe', ignore_status=True, verbose=True) e_msg = ('Failed to stop service %s ' '(see logs for details)' % srv) raise StopServiceError(e_msg)
def start_services(self): self.start_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") srv_manager = service.ServiceManager() for srv in self.services: srv_manager.start(srv) for srv in self.services: if not srv_manager.status(srv): if service.get_name_of_init() == 'systemd': process.run('journalctl -xe', ignore_status=True, verbose=True) e_msg = ('Failed to start service %s ' '(see logs for details)' % srv) raise StartServiceError(e_msg)