Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add response error message output to HTTP Status 401 Errors in FileDo…
…wnloader (#15983) * add missing test dependencies PyJWT and pluginbase * add tests for unauthorized downloads due to missing or bad credentials Also change the TestFileServer to distinguish between the two cases so that we can test them by replacing the bad credentials error message "Not authorized" with "Bad credentials". * add response error message to 401 error in file downloader The source download step attempts to load source_credentials.json when it is present. When following the recommended steps of passing credentials to the source_credentials.json via os.getenv('BACKUP_USER') etc., this can result in the json string "None" when no authentication is provided. This effectively gets translated to the curl call when being read: curl -i -u None:None https://artifactory.example.org/artifactory/source-backup/ This causes an error with status code 401, which currently does not propagate the error message and is slightly misleading, as a source_credentials.json is provided but the content is wrong: ERROR: conanfile.py (example/1.0): Error in source() method, line 17 get(self, self.url, sha256=sha256, strip_root=True) ConanException: The source backup server 'https://artifactory.example.org/artifactory/source-backup/' needs authentication: . Please provide 'source_credentials.json' With this fix, the error message is propagated in the same way others in the same block, resulting in a more useful message, although the "please provide" is still misleading. ERROR: conanfile.py (example/1.0): Error in source() method, line 17 get(self, self.url, sha256=sha256, strip_root=True) ConanException: The source backup server 'https://artifactory.example.org/artifactory/source-backup/' needs authentication: { "errors" : [ { "status" : 401, "message" : "Bad credentials" } ] }. Please provide 'source_credentials.json'
- Loading branch information