From cb09c369d44f9383d31465d3aa7c6e7850f5a0e5 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Thu, 22 Nov 2018 14:22:31 +0100
Subject: [PATCH] added opsdb creds to input data

---
 inventory_provider/config.py | 16 ++++++++++++----
 test/test_data_routes.py     |  6 ++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/inventory_provider/config.py b/inventory_provider/config.py
index 36d81463..101f60e3 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 42878e10..03b955a9 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"),
-- 
GitLab