Satori/ConfigObjectProposal
< Satori
Configuration settings for Satori are currently gathered from the command line via argparse. argparse creates a namespace object that allows variables to be read in dotted attribute for (config.foo, config.bar, etc). However, this makes developers who want to use Satori in their application create their own namespace-like object. The proposed change is to treat the configuration object as a dictionary.
Using Satori in Python Code Today
from satori import discovery class MyConfig(object): pass config = MyConfig() config.username = "bob" config.system_info = "ohai-solo" result = discovery.run('192.0.2.1', config)
Converting the Config Object to a Dictionary
To implement this change, parse_args from satori/shell.py will pass the argparse object to the vars() call. This will convert the object to a dictionary.
Satori in Python Code After Implementation
from satori import discovery result = discovery.run('192.0.2.1', {'username': 'bob', 'system_info': 'ohai-solo)