From 31a0e2410189be3621f04002d43e59b3fccc291b Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Fri, 8 May 2020 09:55:22 +0200 Subject: [PATCH] added optional index param for use with celery --- inventory_provider/config.py | 2 ++ inventory_provider/tasks/config.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/inventory_provider/config.py b/inventory_provider/config.py index 11bec625..eac27acf 100644 --- a/inventory_provider/config.py +++ b/inventory_provider/config.py @@ -37,6 +37,7 @@ CONFIG_SCHEMA = { "properties": { "hostname": {"type": "string"}, "port": {"type": "integer"}, + "index": {"type": "integer"}, "socket_timeout": {"$ref": "#/definitions/timeout"} }, "required": ["hostname", "port"], @@ -47,6 +48,7 @@ CONFIG_SCHEMA = { "properties": { "hostname": {"type": "string"}, "port": {"type": "integer"}, + "index": {"type": "integer"}, "name": {"type": "string"}, "redis_socket_timeout": {"$ref": "#/definitions/timeout"}, "sentinel_socket_timeout": {"$ref": "#/definitions/timeout"} diff --git a/inventory_provider/tasks/config.py b/inventory_provider/tasks/config.py index fede24f7..2ce619c3 100644 --- a/inventory_provider/tasks/config.py +++ b/inventory_provider/tasks/config.py @@ -35,7 +35,7 @@ if 'redis_socket_timeout' in params: _broker_hostname = params['hostname'] _broker_port = params['port'] -_broker_db_index = 1 # TODO: this should be a config param +_broker_db_index = params.get('index', 1) if ':' in _broker_hostname: # assume this means hostname is an ipv6 address -- GitLab