From e0699b3118a79aaba4d36860e19dc3f821a63735 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 1 Jun 2024 23:43:58 +0200 Subject: [PATCH 1/2] fix: fix sysexit with custom error --- ansibledoctor/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansibledoctor/cli.py b/ansibledoctor/cli.py index 46546573..07284d2c 100644 --- a/ansibledoctor/cli.py +++ b/ansibledoctor/cli.py @@ -87,7 +87,7 @@ def _get_config(self): try: config = SingleConfig(args=self.args) except ansibledoctor.exception.ConfigError as e: - self.log.sysexit_with_message(e) + self.log.sysexit_with_message(str(e)) return config From abe019ad70b9dcc611a4398246508d72f586420c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 1 Jun 2024 23:58:04 +0200 Subject: [PATCH 2/2] move fix to sysexit method --- ansibledoctor/cli.py | 2 +- ansibledoctor/doc_generator.py | 2 +- ansibledoctor/utils/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ansibledoctor/cli.py b/ansibledoctor/cli.py index 07284d2c..46546573 100644 --- a/ansibledoctor/cli.py +++ b/ansibledoctor/cli.py @@ -87,7 +87,7 @@ def _get_config(self): try: config = SingleConfig(args=self.args) except ansibledoctor.exception.ConfigError as e: - self.log.sysexit_with_message(str(e)) + self.log.sysexit_with_message(e) return config diff --git a/ansibledoctor/doc_generator.py b/ansibledoctor/doc_generator.py index 7429062f..0b4851fe 100644 --- a/ansibledoctor/doc_generator.py +++ b/ansibledoctor/doc_generator.py @@ -56,7 +56,7 @@ def _create_dir(self, directory): os.makedirs(directory, exist_ok=True) self.logger.info(f"Creating dir: {directory}") except FileExistsError as e: - self.log.sysexit_with_message(str(e)) + self.log.sysexit_with_message(e) def _write_doc(self): files_to_overwite = [] diff --git a/ansibledoctor/utils/__init__.py b/ansibledoctor/utils/__init__.py index 3349f0b2..b65fdaaf 100644 --- a/ansibledoctor/utils/__init__.py +++ b/ansibledoctor/utils/__init__.py @@ -287,7 +287,7 @@ def sysexit(self, code=1): sys.exit(code) def sysexit_with_message(self, msg, code=1): - self.logger.critical(str(msg.strip())) + self.logger.critical(str(msg).strip()) self.sysexit(code)