Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DataCatalog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eFlows4HPC WP2
DataCatalog
Commits
02c75e77
Commit
02c75e77
authored
3 years ago
by
Christian Boettcher
Browse files
Options
Downloads
Patches
Plain Diff
raise httpexception for not found secrets
parent
0f48a88c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apiserver/storage/JsonFileStorageAdapter.py
+7
-1
7 additions, 1 deletion
apiserver/storage/JsonFileStorageAdapter.py
with
7 additions
and
1 deletion
apiserver/storage/JsonFileStorageAdapter.py
+
7
−
1
View file @
02c75e77
...
...
@@ -3,6 +3,7 @@ import os
import
uuid
from
typing
import
Dict
,
List
,
Optional
import
logging
from
fastapi.exceptions
import
HTTPException
from
pydantic
import
BaseModel
...
...
@@ -156,13 +157,18 @@ class JsonFileStorageAdapter(AbstractLocationDataStorageAdapter):
secrets_path
=
self
.
__get_secrets_path
(
value
=
n_type
.
value
,
oid
=
oid
)
secrets
=
self
.
__load_secrets
(
secrets_path
)
# TODO log
try
:
return
secrets
[
key
]
except
KeyError
:
raise
HTTPException
(
404
)
def
delete_secret
(
self
,
n_type
:
LocationDataType
,
oid
:
str
,
key
:
str
,
usr
:
str
):
"""
delete and return the value of the requested secret for the given object
"""
secrets_path
=
self
.
__get_secrets_path
(
value
=
n_type
.
value
,
oid
=
oid
)
secrets
=
self
.
__load_secrets
(
secrets_path
)
val
=
secrets
.
pop
(
key
,
None
)
if
not
val
:
raise
HTTPException
(
404
,
"
Secret does not exist.
"
)
# TODO log
self
.
__store_secrets
(
secrets_path
,
secrets
)
return
val
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment