From db11dec91ae2125c7ec19090dd4ea5449ecec09e Mon Sep 17 00:00:00 2001 From: Joel Diaz Date: Tue, 28 Feb 2017 20:40:14 +0000 Subject: regenerate lib_openshift with yedit exception changes --- roles/lib_openshift/library/oc_adm_router.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'roles/lib_openshift/library/oc_adm_router.py') diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py index 8bbe50ea3..aca4879a1 100644 --- a/roles/lib_openshift/library/oc_adm_router.py +++ b/roles/lib_openshift/library/oc_adm_router.py @@ -396,7 +396,8 @@ class Yedit(object): continue elif data and not isinstance(data, dict): - return None + raise YeditException("Unexpected item type found while going through key " + + "path: {} (at key: {})".format(key, dict_key)) data[dict_key] = {} data = data[dict_key] @@ -405,7 +406,7 @@ class Yedit(object): int(arr_ind) <= len(data) - 1): data = data[int(arr_ind)] else: - return None + raise YeditException("Unexpected item type found while going through key path: {}".format(key)) if key == '': data = item @@ -419,6 +420,12 @@ class Yedit(object): elif key_indexes[-1][1] and isinstance(data, dict): data[key_indexes[-1][1]] = item + # didn't add/update to an existing list, nor add/update key to a dict + # so we must have been provided some syntax like a.b.c[] = "data" for a + # non-existent array + else: + raise YeditException("Error adding to object at path: {}".format(key)) + return data @staticmethod -- cgit v1.2.1