def disable_service(ctx): try: client = ctx.obj['client'] system = System(client) result = system.enable_service(False) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def stop_service(ctx): try: client = ctx.obj['client'] system = System(client) result = system.stop() stdout(result, ctx) except Exception as e: stderr(e, ctx)
def info(ctx): try: client = ctx.obj['client'] system = System(client) result = system.get_info() stdout(result, ctx) except Exception as e: stderr(e, ctx)
def disable_service(ctx): """Disable CSE server.""" try: restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.update_service_status(action=ServerAction.DISABLE) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def stop_service(ctx): """Stop CSE server.""" try: restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.update_service_status(action=ServerAction.STOP) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def system_info(ctx): """Display CSE server info.""" try: restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.get_info() stdout(result, ctx) except Exception as e: stderr(e, ctx)
def disable_service(ctx): """Disable CSE system daemon.""" try: restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.enable_service(False) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def stop_service(ctx): """Stop CSE system daemon.""" try: restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.stop() stdout(result, ctx) except Exception as e: stderr(e, ctx)
def system_info(ctx): """Display CSE server info.""" CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: client_utils.cse_restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.get_info() stdout(result, ctx) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e), exc_info=True)
def disable_service(ctx): """Disable CSE server.""" CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.update_service_status(action=ServerAction.DISABLE) stdout(result, ctx) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e))
def enable_service(ctx): """Enable CSE server.""" CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: client_utils.cse_restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.update_service_status(action=shared_constants.ServerAction.ENABLE) # noqa: E501 stdout(result, ctx) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e))
def system_config(ctx): """Display CSE server info.""" CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: client_utils.cse_restore_session(ctx) client = ctx.obj['client'] system = System(client) result = system.get_runtime_config() result = yaml.safe_dump(result) click.secho(result) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e), exc_info=True)