diff --git a/cm/CHANGES.md b/cm/CHANGES.md index 1c97cbdde..b7132c6c1 100644 --- a/cm/CHANGES.md +++ b/cm/CHANGES.md @@ -1,3 +1,10 @@ +## V3.3.3 + - fixed CM logger issue + +## V3.3.2 + - moved "CMX stack error" to -log + - improved error reporting + ## V3.3.1 - allow "cm/cmx pull repo {URL}" along with "cm/cmx pull repo --url={URL}" - CMX: added "automation_full_path" to -log diff --git a/cm/cmind/__init__.py b/cm/cmind/__init__.py index 9c7cd38d3..441a1eaf1 100644 --- a/cm/cmind/__init__.py +++ b/cm/cmind/__init__.py @@ -2,7 +2,7 @@ # # Written by Grigori Fursin -__version__ = "3.3.1" +__version__ = "3.3.3" from cmind.core import access from cmind.core import x diff --git a/cm/cmind/config.py b/cm/cmind/config.py index 7b5644224..407160190 100644 --- a/cm/cmind/config.py +++ b/cm/cmind/config.py @@ -37,7 +37,7 @@ def __init__(self, config_file = None): "flag_help2": "help", "error_prefix": "CM error:", - "error_prefix2": "CMX detected an issue", + "error_prefix2": "CMX detected a problem", "info_cli": "cm {action} {automation} {artifact(s)} {flags} @input.yaml @input.json", "info_clix": "cmx {action} {automation} {artifact(s)} {CMX control flags (-)} {CMX automation flags (--)}", diff --git a/cm/cmind/core.py b/cm/cmind/core.py index 3e5611394..6c6327b09 100644 --- a/cm/cmind/core.py +++ b/cm/cmind/core.py @@ -103,6 +103,7 @@ def __init__(self, repos_path = '', debug = False): # Logging self.logger = None + self.xlogger = None # Index self.index = None @@ -172,17 +173,18 @@ def errorx(self, r): message = '' - if not self.logger == None or (module_path != '' and lineno != ''): + if not self.xlogger == None or (module_path != '' and lineno != ''): call_stack = self.state.get('call_stack', []) - if not self.logger == None: + if not self.xlogger == None: self.log(f"x error call stack: {call_stack}", "debug") self.log(f"x error: {r}", "debug") - sys.stderr.write('^'*60 + '\n') +# sys.stderr.write('^'*60 + '\n') + sys.stderr.write('\n') - if not self.logger == None: + if not self.xlogger == None: sys.stderr.write('CMX call stack:\n') for cs in call_stack: @@ -195,7 +197,7 @@ def errorx(self, r): message += self.cfg['error_prefix2'] if module_path != '' and lineno !='': - message += f' in {module_path} ({lineno}):\n\n' + message += f' while running automation {module_path} ({lineno}):\n\n' text = r['error'] text = text[0].upper() + text[1:] @@ -295,7 +297,7 @@ def log(self, s, t = 'info'): None """ - logger = self.logger + logger = self.xlogger if logger != None: if t == 'debug': @@ -903,7 +905,7 @@ def x(self, i, out = None): meta = ii) # Check logging - if self.logger is None: + if self.xlogger is None: log_level = None if use_log == "false": @@ -929,7 +931,7 @@ def x(self, i, out = None): log_level = logging.INFO # Configure - self.logger = logging.getLogger("cmx") + self.xlogger = logging.getLogger("cmx") logging.basicConfig(filename = log_file, filemode = 'w', level = log_level) # Check if force out programmatically (such as from CLI) @@ -942,7 +944,7 @@ def x(self, i, out = None): recursion = self.state.get('recursion', 0) self.state['recursion'] = recursion + 1 - if not self.logger == None: + if not self.xlogger == None: log_action = i.get('action', '') log_automation = i.get('automation', '') log_artifact = i.get('artifact', '') @@ -966,7 +968,7 @@ def x(self, i, out = None): r['return'] = 1 r['error'] = delayed_error - if not self.logger == None: + if not self.xlogger == None: self.log(f"x output: {r}", "debug") self.state['recursion'] = recursion @@ -1341,7 +1343,7 @@ def _x(self, i, control): loaded_common_automation = True # Finalize automation class initialization - if not self.logger == None: + if not self.xlogger == None: self.log(f"x automation_full_path: {automation_full_path}", "info") initialized_automation = loaded_automation_class(self, automation_full_path) diff --git a/cm/cmind/repo/automation/repo/module.py b/cm/cmind/repo/automation/repo/module.py index 3e2711f51..eae2345a9 100644 --- a/cm/cmind/repo/automation/repo/module.py +++ b/cm/cmind/repo/automation/repo/module.py @@ -162,8 +162,8 @@ def pull(self, i): warnings = [] - if not self.cmind.logger == None: - self.cmind.log(f"x repo log: {pull_repos}", "debug") +# if not self.cmind.xlogger == None: +# self.cmind.log(f"x repo log: {pull_repos}", "debug") for repo in pull_repos: alias = repo['alias'] diff --git a/requirements.txt b/requirements.txt index 4752077a6..f0e34ec5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -cmind>=2.0.1 +cmind>=3.3.3 pyyaml requests setuptools