naas
naas copied to clipboard
Update naas.secret with new method
We need to make use of the new naas-python.secret SDK. The way we handle secrets should be as follow now:
As a user when I want to get a secret value:
- if the secret exists on api.naas.ai AND exists locally, then I remove the local version.
- If the secret exists on api.naas.ai I use that value.
- If the secret does not exists on api.naas.ai
- If the secret exists locally
- I take the local secret and create it on api.naas.ai.
- I delete the local version of the secret.
As a user when I list secrets:
- First I sync local with api.naas.ai.
- If the secret exists locally AND in api.naas.ai, I remove the local version of the secret.
- If the secret exists locally and does not exists in api.naas.ai, I create it in api.naas.ai and I delete the local version.
- Then, I list the secrets existing in api.naas.ai only.
As a user when I want to create a secret:
- I create it on api.naas.ai.
- If the same secret name exists locally, I remove it.
As a user when I want to delete a secret:
- I remove it from api.naas.ai
- I remove it locally
Doing so, secrets should move from local to api smoothly.
This should allow us to do a drop in replacement of the way we store secret.
@Dr0p42, sounds great!
This issue needs https://github.com/jupyter-naas/naas-python/issues/33 to be completed first
This issue is also blocked by this one: https://github.com/jupyter-naas/naas-python/issues/32
Addition @l-loic , can you add some logic to:
-
if /home/ftp/.naas/secrets.backup.json does not exists: copy /home/ftp/.naas/secrets.json /home/ftp/.naas/secrets.backup.json
This will ensure that we have a backup just in case.