From 03d52fd0f3444bb77ebc20303a5a3ea6f6de1799 Mon Sep 17 00:00:00 2001 From: Jiri Otoupal Date: Wed, 1 Nov 2023 22:43:06 +0100 Subject: [PATCH] logging fix --- abst/__version__.py | 2 +- abst/bastion_support/oci_bastion.py | 1 - abst/main.py | 8 -------- abst/utils/misc_funcs.py | 3 ++- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/abst/__version__.py b/abst/__version__.py index eec3d64..bbb75ae 100644 --- a/abst/__version__.py +++ b/abst/__version__.py @@ -10,7 +10,7 @@ "CLI Command making OCI Bastion and kubernetes usage simple and fast" ) -__version__ = "2.1.8" +__version__ = "2.1.9" __author__ = "Jiri Otoupal" __author_email__ = "jiri-otoupal@ips-database.eu" __license__ = "MIT" diff --git a/abst/bastion_support/oci_bastion.py b/abst/bastion_support/oci_bastion.py index b343431..fef9d57 100644 --- a/abst/bastion_support/oci_bastion.py +++ b/abst/bastion_support/oci_bastion.py @@ -380,7 +380,6 @@ def load_json(cls, path=default_creds_path) -> dict: @classmethod def create_default_location(cls): - Path(default_creds_path.parent).mkdir(exist_ok=True) Path(default_contexts_location).mkdir(exist_ok=True) diff --git a/abst/main.py b/abst/main.py index 9fb4674..ff803f3 100644 --- a/abst/main.py +++ b/abst/main.py @@ -1,11 +1,9 @@ -import logging import os import signal import click import rich from InquirerPy import inquirer -from rich.logging import RichHandler from abst.__version__ import __version_name__, __version__ from abst.bastion_support.bastion_scheduler import BastionScheduler @@ -85,12 +83,6 @@ def clean(): def main(): - logging.basicConfig( - level=logging.DEBUG, - format="%(message)s", - datefmt="[%X]", - handlers=[RichHandler()], - ) Bastion.create_default_location() cli() diff --git a/abst/utils/misc_funcs.py b/abst/utils/misc_funcs.py index 5dc4a36..5b24c3a 100644 --- a/abst/utils/misc_funcs.py +++ b/abst/utils/misc_funcs.py @@ -24,7 +24,8 @@ def setup_debug(debug): if not debug: logging.disable(logging.DEBUG) logging.disable(logging.INFO) - + from imp import reload # python 2.x don't need to import reload, use it directly + reload(logging) logging.basicConfig( level=logging.DEBUG if debug else logging.CRITICAL, format="%(message)s",