Conversation
d6cbcb8 to
1a27e76
Compare
1a27e76 to
533aa40
Compare
533aa40 to
e2520bf
Compare
Configs are split in two: reader and writer for ro/wo api services respectively. main-reader/main-writer entry point files are added.
e2520bf to
c513c2f
Compare
|
|
||
| def get_config(api_type=None): | ||
| """Return cached configuration. | ||
|
|
| config = json.load(open(path)) | ||
| CONF[api_type] = json.load(open(path)) | ||
| logging.info("Config is '%s'" % path) | ||
| except IOError as e: |
There was a problem hiding this comment.
I recommend to catch ValueError as well for cases with invalid JSON
| jsonschema.validate(CONF[api_type], CONF_SCHEMA) | ||
| except jsonschema.ValidationError as e: | ||
| logging.error(e.message) | ||
| sys.exit(1) |
There was a problem hiding this comment.
raise, not exit (exiting inside a non-CLI module is a potential bug)
There was a problem hiding this comment.
agreed. This whole thing should be rewritten to oss-tools configuration I guess, but it was written well before oss-tools had config management.
|
|
||
| @app.errorhandler(404) | ||
| def not_found(error): | ||
| logging.error(error) |
There was a problem hiding this comment.
that's arguable, but let's change it to debug I guess =)
| ensure_index("ms_{}_{}".format("runbooks", region), api_type) | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
There was a problem hiding this comment.
This is a strange usage, this module is not a CLI endpoint.
There was a problem hiding this comment.
Well in a later commit I think I'm adding a function from the file to setup.cfg Although this does mean that I can do it right here =)
No description provided.