omnibus
omnibus copied to clipboard
Refactor dispatch.py to avoid code re-use
trafficstars
In current master branch, the code re-use in Dispatch.py is insane. This has cut the file size down in over half it's size, the workflow makes much more sense, avoid code re-use, and is much easier to follow overall
I've reworked this so all modules and machines go to a single submit function within Dispatch:
- if no argument is required for module, run the module and return results
- attempt to lookup artifact by session ID if provided, otherwise use artifact by name
- verify artifact exists in DB
- populate list of modules to run against artifact (singular if it isnt a machine, multiple if it is)
- send these modules to execute via
self.runagainst the artifact and return results- same as before; gets modular pointer via importlib, runs the module and returns results
- call
self.save_results- to update any existing documents and create any children documents
- create nice JSON data for command line output and return this to omnibus-cli