From 817c3ca3d6339cc0d98ce8e81578e3a145832150 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 20 Oct 2015 18:24:15 -0400 Subject: Secrets: Allow creation of root directories The code was errnoeously refusing to create containers or keys on the base directory where there are no parents. For single component keys always assume / exists in the database. Signed-off-by: Simo Sorce Reviewed-by: Christian Heimes --- custodia/secrets.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custodia/secrets.py b/custodia/secrets.py index 8a4d821..b598667 100644 --- a/custodia/secrets.py +++ b/custodia/secrets.py @@ -114,9 +114,10 @@ class Secrets(HTTPConsumer): default = request.get('default_namespace', None) basename = self._db_container_key(None, trail) try: - ok = self._parent_exists(default, trail[:-1]) - if not ok: - raise HTTPError(404) + if len(trail) > 2: + ok = self._parent_exists(default, trail[:-1]) + if not ok: + raise HTTPError(404) self.root.store.span(basename) except CSStoreExists: -- cgit