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

Check fails if bucket is empty #49

Open
1 task
charles-dyfis-net opened this issue Dec 28, 2022 · 0 comments · May be fixed by #51
Open
1 task

Check fails if bucket is empty #49

charles-dyfis-net opened this issue Dec 28, 2022 · 0 comments · May be fixed by #51

Comments

@charles-dyfis-net
Copy link

When a bucket has no initial contents, this resource fails with the error:

jq: error (at <stdin>:1): Cannot iterate over null (null)

This is because in this scenario, aws s3api list-objects --query 'Contents[].{LastModified: LastModified}' returns null, and max_by(.LastModified) is not a valid jq query.

Acceptance Criteria

  • The check for an empty bucket should return an empty list of versions, rather than returning an error.
charles-dyfis-net added a commit to charles-dyfis-net/s3-resource-simple that referenced this issue Dec 28, 2022
- Avoid calling jq more than once per operation. To do this, we have `jq` generate assignments with eval-safe escaping setting shell variables.
- Avoid passing anything but options through eval (keeping options themselves from being eval'd will be a compatibility-breaking change, and is the subject of cloud-gov#50).
- Avoid using `echo` to handle non-constant data (which introduces substantial portability problems across different implementations of `sh`; see https://unix.stackexchange.com/a/65819/3113 and https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html).
- Handle "null" return value from `aws s3api list-objects` gratefully (cloud-gov#49)
charles-dyfis-net added a commit to charles-dyfis-net/s3-resource-simple that referenced this issue Dec 28, 2022
- Avoid calling jq more than once per operation. To do this, we have `jq` generate assignments with eval-safe escaping setting shell variables.
- Avoid passing anything but options through eval (keeping options themselves from being eval'd will be a compatibility-breaking change, and is the subject of cloud-gov#50).
- Avoid using `echo` to handle non-constant data (which introduces substantial portability problems across different implementations of `sh`; see https://unix.stackexchange.com/a/65819/3113 and https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html).
- Handle "null" return value from `aws s3api list-objects` gratefully (cloud-gov#49)
@charles-dyfis-net charles-dyfis-net linked a pull request Dec 28, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant