From a755cfcc688f50449a9ef7b58c8887dbd98402e7 Mon Sep 17 00:00:00 2001 From: Nathan Denny Date: Mon, 28 Oct 2024 10:59:52 -0400 Subject: [PATCH] WORK IN PROGRESS - refactoring to use better structured request-result --- bin/bastion.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/bin/bastion.py b/bin/bastion.py index 223a005..c4644e1 100755 --- a/bin/bastion.py +++ b/bin/bastion.py @@ -189,13 +189,8 @@ def run(self): for idiom in idioms: tokens = idiom.split() if tokens == comargs[:len(tokens)]: - action = method - - #-- create a process tracking structure. - proc = { - 'task.started': datetime.datetime.now().isoformat(), - 'task.session': opts.get('task.session', self.session) - } + action = method + request = CARP.Request(idiom, comargs[len(tokens):]) #-- execute the action within crash guardrails try: @@ -204,12 +199,7 @@ def run(self): tb = traceback.format_exception(err) answer = CRASHED( ''.join(tb), tb ) #-- always log crashes! - answer['context']['log.scope'] = '*' - - proc['task.ended'] = datetime.datetime.now().isoformat() - - #-- include the user's request as part of the answered report - answer['request'] = ' '.join(comargs) + answer.context['log.scope'] = '*' #-- embed the process tracking info as part of the reply context for k, v in proc.items():