diff --git a/brian_polling_manager/cli.py b/brian_polling_manager/cli.py index 48f4e82485d89aad665d9c1c92f7138883893827..f78df640d949a04d4e4a9e10f5a00d24db7e327e 100644 --- a/brian_polling_manager/cli.py +++ b/brian_polling_manager/cli.py @@ -46,7 +46,7 @@ _DEFAULT_CONFIG = { 'https://test-poller-sensu-agent02.geant.org:8080', 'https://test-poller-sensu-agent03.geant.org:8080' ], - 'token': '696a815c-607e-4090-81de-58988c83033e', + 'api-key': '696a815c-607e-4090-81de-58988c83033e', 'interface-check': { 'script': '/var/lib/sensu/bin/counter2influx.sh', 'measurement': 'counters', @@ -103,10 +103,10 @@ CONFIG_SCHEMA = { 'items': {'type': 'string'}, 'minItems': 1 }, - 'token': {'type': 'string'}, + 'api-key': {'type': 'string'}, 'interface-check': {'$ref': '#/definitions/influx-check'} }, - 'required': ['api-base', 'token', 'interface-check'], + 'required': ['api-base', 'api-key', 'interface-check'], 'additionalProperties': False }, 'statsd': { diff --git a/brian_polling_manager/sensu.py b/brian_polling_manager/sensu.py index 18c6b9831604b5596661bc4cc13762889e1f9756..0c60d091320f7ddfbc8a94aa5423b34c7a1dc9f2 100644 --- a/brian_polling_manager/sensu.py +++ b/brian_polling_manager/sensu.py @@ -13,7 +13,7 @@ def load_all_checks(params, namespace='default'): r = requests.get( f'{url}/api/core/v2/namespaces/{namespace}/checks', headers={ - 'Authorization': f'Key {params["token"]}', + 'Authorization': f'Key {params["api-key"]}', 'Accepts': 'application/json', }) r.raise_for_status() @@ -28,7 +28,7 @@ def create_check(params, check, namespace='default'): r = requests.post( f'{url}/api/core/v2/namespaces/{namespace}/checks', headers={ - 'Authorization': f'Key {params["token"]}', + 'Authorization': f'Key {params["api-key"]}', 'Content-Type': 'application/json', }, json=check) @@ -42,7 +42,7 @@ def update_check(params, check, namespace='default'): r = requests.put( f'{url}/api/core/v2/namespaces/{namespace}/checks/{name}', headers={ - 'Authorization': f'Key {params["token"]}', + 'Authorization': f'Key {params["api-key"]}', 'Content-Type': 'application/json', }, json=check) @@ -58,5 +58,5 @@ def delete_check(params, check, namespace='default'): url = random.choice(params['api-base']) r = requests.delete( f'{url}/api/core/v2/namespaces/{namespace}/checks/{name}', - headers={'Authorization': f'Key {params["token"]}'}) + headers={'Authorization': f'Key {params["api-key"]}'}) r.raise_for_status() diff --git a/test/conftest.py b/test/conftest.py index f86f451629ed27ffdff82ac7e3122f89804399e8..9244fd8cbceda2598cc8e7192a1cb1e9706e6d25 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -32,7 +32,7 @@ def config(): 'https://bogus-sensu02.xxx.yyy:12345', 'https://bogus-sensu03.xxx.yyy:12345' ], - 'token': 'abc-token-blah-blah', + 'api-key': 'abc-sensu-key-blah-blah', 'interface-check': { 'script': '/var/lib/sensu/bin/counter2influx.sh', 'measurement': 'counters',