Skip to content

Commit

Permalink
WORK IN PROGRESS - refactoring to use better structured request-result
Browse files Browse the repository at this point in the history
  • Loading branch information
ndenny committed Oct 28, 2024
1 parent b0ced79 commit a755cfc
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions bin/bastion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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():
Expand Down

0 comments on commit a755cfc

Please sign in to comment.