diff --git a/inventory_provider/config.py b/inventory_provider/config.py index 36d814633db7b53fdc9038b5c373f173bf4e6326..101f60e3688b37bdbee0eeeb1d2f55844bd736dc 100644 --- a/inventory_provider/config.py +++ b/inventory_provider/config.py @@ -6,9 +6,9 @@ import jsonschema CONFIG_SCHEMA = { "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "alarms-db": { + + "definitions": { + "database_credentials": { "type": "object", "properties": { "hostname": {"type": "string"}, @@ -18,7 +18,14 @@ CONFIG_SCHEMA = { }, "required": ["hostname", "dbname", "username", "password"], "additionalProperties": False - }, + + } + }, + + "type": "object", + "properties": { + "alarms-db": {"$ref": "#/definitions/database_credentials"}, + "ops-db": {"$ref": "#/definitions/database_credentials"}, "oid_list.conf": {"type": "string"}, "routers_community.conf": {"type": "string"}, "ssh": { @@ -42,6 +49,7 @@ CONFIG_SCHEMA = { }, "required": [ "alarms-db", + "ops-db", "oid_list.conf", "routers_community.conf", "ssh", diff --git a/test/test_data_routes.py b/test/test_data_routes.py index 42878e10b79bddc64d4c509ed24f8fbfb7cf9385..03b955a9a0c668fed6385e32e78ff6ece991dc3f 100644 --- a/test/test_data_routes.py +++ b/test/test_data_routes.py @@ -90,6 +90,12 @@ def data_config_filename(tmp_dir_name): "username": "xxxxxx", "password": "xxxxxxxx" }, + "ops-db": { + "hostname": "xxxxxxx.yyyyy.zzz", + "dbname": "xxxxxx", + "username": "xxxxxx", + "password": "xxxxxxxx" + }, "oid_list.conf": os.path.join( tmp_dir_name, "oid_list.conf"),