summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-10-20 18:24:15 -0400
committerSimo Sorce <simo@redhat.com>2015-10-23 14:10:39 -0400
commit817c3ca3d6339cc0d98ce8e81578e3a145832150 (patch)
treef9f90f9f55cc7c634d38fbdc7a1b60d676bc52ef
parent274b73b62b6e809110d69c2907f6e30804b4e378 (diff)
downloadcustodia-817c3ca3d6339cc0d98ce8e81578e3a145832150.tar.gz
custodia-817c3ca3d6339cc0d98ce8e81578e3a145832150.tar.xz
custodia-817c3ca3d6339cc0d98ce8e81578e3a145832150.zip
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 <simo@redhat.com> Reviewed-by: Christian Heimes <cheimes@redhat.com>
-rw-r--r--custodia/secrets.py7
1 files 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: