Open sebastian-luna-valero opened 1 year ago
Fixed in https://github.com/tdviet/fedcloudclient/commit/c14ea4d4ebe7571fbd580ee381aae5e64c1ad482
Vault does not distinguish whether listing empty or nonexistent folder. Therefore, a friendly message "The target path is empty or does not exist." will be printed in stderr instead of blank output.
Now I am getting:
$ fedcloud secret list
An unexpected error occurred: Error: Error when accessing secrets on server. Server response: HTTPError: 403 Client Error: Forbidden for url: https://vault.services.fedcloud.eu:8200/v1/cubbyhole/?list=true
Would it be correct to simply print out instead:
No lockers found.
$ fedcloud secret list An unexpected error occurred: Error: Error when accessing secrets on server. Server response: HTTPError: 403 Client Error: Forbidden for url: https://vault.services.fedcloud.eu:8200/v1/cubbyhole/?list=true
This is another error, authentication error, because the locker token is expired (either number of use or lifetime)
No lockers found.
Excellent idea, thank you for suggestion. I would change the message little "No secrets found". If the locker was created, it does exist, but only is empty. Furthermore, the fedcloud secret list
command is used also for accessing permanent secret storage (key/value engine) and users get the same error when listing empty or non-existent path
Then No secrets found
is more appropriate, thanks!
Thanks!
This works now when FEDCLOUD_LOCKER_TOKEN is set and no lockers have been created.
But there are two other scenarios where I think the No secrets found
could also be better than the current behavior:
fedcloud secret list
An unexpected error occurred: Error: Error when accessing secrets on server. Server response: InvalidPath: None, on list https://vault.services.fedcloud.eu:8200/v1/secrets/users/<EGI-ID>egi.eu
fedcloud secret locker check
Error: Error when accessing secrets on server. Server response: Forbidden: permission denied, on get https://vault.services.fedcloud.eu:8200/v1/auth/token/lookup-self
fedcloud secret list
An unexpected error occurred: Error: Error when accessing secrets on server. Server response: HTTPError: 403 Client Error: Forbidden for url: https://vault.services.fedcloud.eu:8200/v1/cubbyhole/?list=true
We need to catch exceptions and manage the error messages systematically. So far put it on hold as a request for improvement
Initial checklist
Affected packages and versions
2.0-alpha1
Link to runnable example
No response
Steps to reproduce
Expected behavior
Return empty list.
Actual behavior
Affected runtime and version
python@3.12
Affected package manager and version
No response
Affected OS and version
No response
Build and bundle tools
No response