Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3: provide more helpful messages on common errors #4480

Merged
merged 6 commits into from
Aug 27, 2020

Conversation

efiop
Copy link
Contributor

@efiop efiop commented Aug 27, 2020

Fix #4478

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

@efiop efiop added enhancement Enhances DVC ui user interface / interaction labels Aug 27, 2020
efiop added a commit to iterative/dvc.org that referenced this pull request Aug 27, 2020
efiop added a commit to iterative/dvc.org that referenced this pull request Aug 27, 2020
efiop added a commit to iterative/dvc.org that referenced this pull request Aug 27, 2020
@efiop efiop changed the title [WIP] s3: provide more helpful messages on common errors s3: provide more helpful messages on common errors Aug 27, 2020
@@ -162,7 +162,7 @@ class RelPath(str):
"endpointurl": str,
"access_key_id": str,
"secret_access_key": str,
Optional("listobjects", default=False): Bool,
Optional("listobjects", default=False): Bool, # obsoleted
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obsoleted since we are using a high-level resource API now, which just does the switch automatically.

@@ -75,24 +73,52 @@ def s3(self):

session = boto3.session.Session(**session_opts)

return session.client(
return session.resource(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource is a higher level API, so we don't have to manually parse-out HTTP codes.

dvc/tree/s3.py Outdated Show resolved Hide resolved
try:
yield bucket.Object(path_info.path)
except bucket.meta.client.exceptions.NoSuchKey as exc:
raise DvcException(f"{path_info.url} does not exist") from exc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll move to FileNotFoundError in the future, but for now just doing the same thing that we used to.

efiop and others added 2 commits August 27, 2020 07:01
Co-authored-by: Jorge Orpinel <jorgeorpinel@users.noreply.github.com>
dvc/tree/s3.py Outdated Show resolved Hide resolved
@efiop efiop merged commit b9d685a into iterative:master Aug 27, 2020
@efiop efiop deleted the fix-4478 branch August 27, 2020 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances DVC ui user interface / interaction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

s3: better error on missing credentials
3 participants