Support for handling API errors from Podman
lirremotus opened this issue ยท 1 comments
Community Note
- Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
The Coder (coder.com) application makes use of this Terraform provider to interact with Docker. For the most part, when replacing Docker with Podman, this continues to work very well, which is awesome! I have noticed a small inconsistency in how error messages are reported from the Podman API vs the Docker API that causes an error to be reported in Coder (although the functionality still works), and which I believe could be easily worked around here to allow more complete replacement of Docker with Podman in some situations.
When the Docker API returns an error indicating that there is no such container, the response is "No such container". Podman returns "no such container" (lowercase). My suggestion is to make containsIgnorableErrorMessage
(in internal/provider/helpers.go
) lowercase the errorMsg
and ignorableErrorMessages
that it takes in so that the comparison would work for either case, and allow more interoperability with the Podman API.
New or Affected Resource(s)
- This appears to affect any resource that can return the "No such container" response, although any response returned with capitalization seems likely to be affected. I noticed this specifically with the
resourceDockerContainerDelete
function when it waits for the container to be deleted:if !containsIgnorableErrorMessage(err.Error(), "No such container", "is already in progress") {
Potential Terraform Configuration
References
It looks like #583 will resolve this issue, since it implements the changes proposed here.