From 4fe7b63bc683ecb514a9ee2bcf8a9884ad10016c Mon Sep 17 00:00:00 2001 From: Colin Murtaugh Date: Wed, 27 Nov 2019 10:18:34 -0500 Subject: [PATCH] log a warning when we get no params from SSM for a given prefix --- dj_secure_settings/loader.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dj_secure_settings/loader.py b/dj_secure_settings/loader.py index f4ce7bb..5c854a0 100644 --- a/dj_secure_settings/loader.py +++ b/dj_secure_settings/loader.py @@ -103,6 +103,7 @@ def _load_params_from_ssm(config, path_prefix, region_name=None): ssm = boto3.client("ssm", region_name=region_name) args = {"Path": path_prefix, "Recursive": True, "WithDecryption": True} more = None + params_found = 0 while more is not False: if more: args["NextToken"] = more @@ -110,8 +111,12 @@ def _load_params_from_ssm(config, path_prefix, region_name=None): for param in params["Parameters"]: keys = param['Name'][len(path_prefix):].split('/') _set_nested(config, keys, param['Value']) + params_found += 1 more = params.get("NextToken", False) + if params_found == 0: + logging.warning('Found no SSM parameters for prefix {}'.format(path_prefix)) + def _set_nested(dic, keys, value): # this sets a value in an arbitrarily-deeply nested dict