From bfa86f2b4e249ff40a6fe0e5ea302407914fd4a6 Mon Sep 17 00:00:00 2001 From: badrogger Date: Thu, 21 Sep 2023 17:40:00 +0000 Subject: [PATCH] Fix exit codes on Exception --- node_cli/core/schains.py | 1 - node_cli/main.py | 8 ++++---- node_cli/utils/docker_utils.py | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/node_cli/core/schains.py b/node_cli/core/schains.py index 0a27abcf..d4fa9b05 100644 --- a/node_cli/core/schains.py +++ b/node_cli/core/schains.py @@ -7,7 +7,6 @@ from typing import Dict, Optional from node_cli.configs import NODE_CONFIG_PATH -from node_cli.core.node import get_node_info_plain from node_cli.utils.helper import get_request, post_request, error_exit from node_cli.utils.exit_codes import CLIExitCodes from node_cli.utils.print_formatters import ( diff --git a/node_cli/main.py b/node_cli/main.py index aa1a7e54..10009022 100644 --- a/node_cli/main.py +++ b/node_cli/main.py @@ -40,6 +40,7 @@ from node_cli.utils.helper import safe_load_texts, init_default_logger from node_cli.configs import LONG_LINE from node_cli.core.host import init_logs_dir +from node_cli.utils.helper import error_exit TEXTS = safe_load_texts() @@ -109,8 +110,7 @@ def handle_exception(exc_type, exc_value, exc_traceback): try: cmd_collection() except Exception as err: - print(f'Command execution failed with {err}. Recheck your inputs') traceback.print_exc() - logger.exception(f'Command failed with {err}') - finally: - logger.debug(f'execution time: {time.time() - start_time} seconds') + logger.debug('Execution time: %d seconds', time.time() - start_time) + error_exit(err) + logger.debug('Execution time: %d seconds', time.time() - start_time) diff --git a/node_cli/utils/docker_utils.py b/node_cli/utils/docker_utils.py index 9a2911c8..9403ae41 100644 --- a/node_cli/utils/docker_utils.py +++ b/node_cli/utils/docker_utils.py @@ -222,6 +222,7 @@ def get_up_compose_cmd(services): def compose_up(env): logger.info('Running base set of containers') + logger.debug('ENV for docker-compose.yml %s', env) if 'SGX_CERTIFICATES_DIR_NAME' not in env: env['SGX_CERTIFICATES_DIR_NAME'] = SGX_CERTIFICATES_DIR_NAME