Skip to content

Commit 03eb0b2

Browse files
authored
V3.3.2 (#1347)
## V3.3.2 - moved "CMX stack error" to -log - improved error reporting
2 parents dfefc2a + 4f740f1 commit 03eb0b2

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

Diff for: cm/CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## V3.3.3
2+
- fixed CM logger issue
3+
4+
## V3.3.2
5+
- moved "CMX stack error" to -log
6+
- improved error reporting
7+
18
## V3.3.1
29
- allow "cm/cmx pull repo {URL}" along with "cm/cmx pull repo --url={URL}"
310
- CMX: added "automation_full_path" to -log

Diff for: cm/cmind/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Written by Grigori Fursin
44

5-
__version__ = "3.3.1"
5+
__version__ = "3.3.3"
66

77
from cmind.core import access
88
from cmind.core import x

Diff for: cm/cmind/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, config_file = None):
3737
"flag_help2": "help",
3838

3939
"error_prefix": "CM error:",
40-
"error_prefix2": "CMX detected an issue",
40+
"error_prefix2": "CMX detected a problem",
4141
"info_cli": "cm {action} {automation} {artifact(s)} {flags} @input.yaml @input.json",
4242
"info_clix": "cmx {action} {automation} {artifact(s)} {CMX control flags (-)} {CMX automation flags (--)}",
4343

Diff for: cm/cmind/core.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def __init__(self, repos_path = '', debug = False):
103103

104104
# Logging
105105
self.logger = None
106+
self.xlogger = None
106107

107108
# Index
108109
self.index = None
@@ -172,17 +173,18 @@ def errorx(self, r):
172173

173174
message = ''
174175

175-
if not self.logger == None or (module_path != '' and lineno != ''):
176+
if not self.xlogger == None or (module_path != '' and lineno != ''):
176177
call_stack = self.state.get('call_stack', [])
177178

178-
if not self.logger == None:
179+
if not self.xlogger == None:
179180

180181
self.log(f"x error call stack: {call_stack}", "debug")
181182
self.log(f"x error: {r}", "debug")
182183

183-
sys.stderr.write('^'*60 + '\n')
184+
# sys.stderr.write('^'*60 + '\n')
185+
sys.stderr.write('\n')
184186

185-
if not self.logger == None:
187+
if not self.xlogger == None:
186188
sys.stderr.write('CMX call stack:\n')
187189

188190
for cs in call_stack:
@@ -195,7 +197,7 @@ def errorx(self, r):
195197
message += self.cfg['error_prefix2']
196198

197199
if module_path != '' and lineno !='':
198-
message += f' in {module_path} ({lineno}):\n\n'
200+
message += f' while running automation {module_path} ({lineno}):\n\n'
199201
text = r['error']
200202
text = text[0].upper() + text[1:]
201203

@@ -295,7 +297,7 @@ def log(self, s, t = 'info'):
295297
None
296298
"""
297299

298-
logger = self.logger
300+
logger = self.xlogger
299301

300302
if logger != None:
301303
if t == 'debug':
@@ -903,7 +905,7 @@ def x(self, i, out = None):
903905
meta = ii)
904906

905907
# Check logging
906-
if self.logger is None:
908+
if self.xlogger is None:
907909
log_level = None
908910

909911
if use_log == "false":
@@ -929,7 +931,7 @@ def x(self, i, out = None):
929931
log_level = logging.INFO
930932

931933
# Configure
932-
self.logger = logging.getLogger("cmx")
934+
self.xlogger = logging.getLogger("cmx")
933935
logging.basicConfig(filename = log_file, filemode = 'w', level = log_level)
934936

935937
# Check if force out programmatically (such as from CLI)
@@ -942,7 +944,7 @@ def x(self, i, out = None):
942944
recursion = self.state.get('recursion', 0)
943945
self.state['recursion'] = recursion + 1
944946

945-
if not self.logger == None:
947+
if not self.xlogger == None:
946948
log_action = i.get('action', '')
947949
log_automation = i.get('automation', '')
948950
log_artifact = i.get('artifact', '')
@@ -966,7 +968,7 @@ def x(self, i, out = None):
966968
r['return'] = 1
967969
r['error'] = delayed_error
968970

969-
if not self.logger == None:
971+
if not self.xlogger == None:
970972
self.log(f"x output: {r}", "debug")
971973

972974
self.state['recursion'] = recursion
@@ -1341,7 +1343,7 @@ def _x(self, i, control):
13411343
loaded_common_automation = True
13421344

13431345
# Finalize automation class initialization
1344-
if not self.logger == None:
1346+
if not self.xlogger == None:
13451347
self.log(f"x automation_full_path: {automation_full_path}", "info")
13461348

13471349
initialized_automation = loaded_automation_class(self, automation_full_path)

Diff for: cm/cmind/repo/automation/repo/module.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ def pull(self, i):
162162

163163
warnings = []
164164

165-
if not self.cmind.logger == None:
166-
self.cmind.log(f"x repo log: {pull_repos}", "debug")
165+
# if not self.cmind.xlogger == None:
166+
# self.cmind.log(f"x repo log: {pull_repos}", "debug")
167167

168168
for repo in pull_repos:
169169
alias = repo['alias']

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmind>=2.0.1
1+
cmind>=3.3.3
22
pyyaml
33
requests
44
setuptools

0 commit comments

Comments
 (0)