Open antoniivanov opened 8 months ago
Hey @antoniivanov , we tried reproducing this locally and the command fails as expected, e.g.:
`(sc-vdk) [ddakov@ddakovvm venvs]$ vdk -v debug secrets -n mzhivkov-job -t supercollider --set-prompt "key2" Passed parameters to function <function secrets_command at 0x79f0fb332160>: (), {'name': 'mzhivkov-job', 'team': 'supercollider', 'set_prompt': ('key2',), 'set': (), 'delete': (), 'delete_all_job_secrets': False, 'overwrite_all_job_secrets': None, 'get': None, 'list': False, 'rest_api_url': 'https://dp.supercollider.vmware.com', 'output': 'TEXT'} secrets passed options: name: mzhivkov-job, team: supercollider, set: (), set_prompt: ('key2',), get: None, list: False, delete: () rest_api_url: https://dp.supercollider.vmware.com, output: TEXT key2: Rest API URL: https://dp.supercollider.vmware.com Reading vdk credential file: /home/ddakov/.vdk.internal/vdk-cred.json ... Acquire access token (it's either expired or missing) ... Using auth type None to acquire access token No authentication mechanism found. Will not cache access token.If Control Service authentication is enabled, API calls will fail. Call function vdk.internal.control.command_groups.job.secrets.update_secrets --- Logging error --- Traceback (most recent call last): File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/vdk/internal/control/rest_lib/rest_client_errors.py", line 57, in decorated result = fn(*args, kwargs) File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/vdk/internal/control/command_groups/job/secrets.py", line 129, in update_secrets remote_secrets = self.get_all_remote_secrets() File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/vdk/internal/control/command_groups/job/secrets.py", line 52, in get_all_remote_secrets return self.__secrets_api.data_job_secrets_read( File "pydantic/decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function File "pydantic/decorator.py", line 134, in pydantic.decorator.ValidatedFunction.call File "pydantic/decorator.py", line 206, in pydantic.decorator.ValidatedFunction.execute File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/api/data_jobs_secrets_api.py", line 78, in data_job_secrets_read return self.data_job_secrets_read_with_http_info(team_name, job_name, deployment_id, kwargs) # noqa: E501 File "pydantic/decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function File "pydantic/decorator.py", line 134, in pydantic.decorator.ValidatedFunction.call File "pydantic/decorator.py", line 206, in pydantic.decorator.ValidatedFunction.execute File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/api/data_jobs_secrets_api.py", line 185, in data_job_secrets_read_with_http_info return self.api_client.call_api( File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/api_client.py", line 406, in call_api return self.__call_api(resource_path, method, File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/api_client.py", line 221, in call_api raise e File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/api_client.py", line 211, in call_api response_data = self.request( File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/api_client.py", line 432, in request return self.rest_client.get_request(url, File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/rest.py", line 239, in get_request return self.request("GET", url, File "/home/ddakov/dev/venvs/sc-vdk/lib/python3.9/site-packages/taurus_datajob_api/rest.py", line 222, in request raise UnauthorizedException(http_resp=r) taurus_datajob_api.exceptions.UnauthorizedException: (401) Reason: HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 21 Feb 2024 13:28:58 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'WWW-Authenticate': 'Bearer', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'X-Frame-Options': 'DENY'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ddakov/.pyenv/versions/3.9.16/lib/python3.9/logging/init.py", line 1083, in emit
msg = self.format(record)
File "/home/ddakov/.pyenv/versions/3.9.16/lib/python3.9/logging/init.py", line 927, in format
return fmt.format(record)
File "/home/ddakov/.pyenv/versions/3.9.16/lib/python3.9/logging/init.py", line 663, in format
record.message = record.getMessage()
File "/home/ddakov/.pyenv/versions/3.9.16/lib/python3.9/logging/init.py", line 367, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "/home/ddakov/dev/venvs/sc-vdk/bin/vdk", line 33, in
Error: ¯_(ツ)_/¯
what: Control Service Error why: The request has not been applied because it lacks valid authentication credentials. Error returned by control service is b'' consequences: Operation cannot complete. countermeasures: Try to login again using VDK CLI login command.Or set correct api token configuration (see vdk config-help).Make sure you have permission to execute the given operation.Investigate (google) the error returned by control service.And if all fails try to contact the support team.
Check version for package supercollider-vdk from index https://build-artifactory.eng.vmware.com/api/pypi/supercollider-pypi-local/simple ... Current version of supercollider-vdk is (0, 0, 9070299) and highest is (0, 0, 9070299) `
Describe the bug When attempting to set a secret using the
vdk secrets --set-prompt
command, the operation incorrectly reports success even when it fails due to authentication issues. This behavior is misleading and can lead to confusion about the actual state of the secret.This behaviour is noticeable in other commands as well like vdk deploy or vdk show , vdk list, vdk create
Steps To Reproduce Steps to reproduce the behavior:
export VDK_API_TOKEN=wrong-token
Expected behavior The command should fail and return an error message indicating the failure due to authentication issues.
Log Snippet Command:
vdk -v debug secrets --set-prompt "xxx_password" -n aivanov-xxx -t supercollider
Version (please complete the following information):