def stop_booth(env: LibraryEnvironment, instance_name=None): """ Stop specified instance of booth service, systemd systems supported only. env string instance_name -- booth instance name """ ensure_is_systemd(env.service_manager) booth_env = env.get_booth_env(instance_name) _ensure_live_env(env, booth_env) instance_name = booth_env.instance_name try: env.service_manager.stop("booth", instance=instance_name) except ManageServiceError as e: raise LibraryError(service_exception_to_report(e)) from e env.report_processor.report( ReportItem.info( reports.messages.ServiceActionSucceeded( reports.const.SERVICE_ACTION_STOP, "booth", instance=instance_name, ) ) )
def start_booth(env: LibraryEnvironment, instance_name=None): """ Start specified instance of booth service, systemd systems supported only. On non-systemd systems it can be run like this: BOOTH_CONF_FILE=<booth-file-path> /etc/initd/booth-arbitrator env string instance_name -- booth instance name """ ensure_is_systemd(env.service_manager) booth_env = env.get_booth_env(instance_name) _ensure_live_env(env, booth_env) instance_name = booth_env.instance_name try: env.service_manager.start("booth", instance=instance_name) except ManageServiceError as e: raise LibraryError(service_exception_to_report(e)) from e env.report_processor.report( ReportItem.info( reports.messages.ServiceActionSucceeded( reports.const.SERVICE_ACTION_START, "booth", instance=instance_name, ) ) )