-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
request.WaiterAcceptor.Matcher
does not work with JMESPath's comparison operators
#2478
Comments
Hi @minamijoyo, thanks for reaching out to us about this and for the extensive level of detail provided regarding this behavior. I'm looking into this and will update again once I have more information. Please feel free to reply with any additional information you come across on this in the meantime. |
Thank you for your patience in this matter @minamijoyo. As you've mentioned, this behavior stems from |
@diehlaws Thank you for working on this and opening the issue on upstream. |
@diehlaws I see jmespath/go-jmespath#30, which seemed related, but it seems to be a different issue since it isn't fixed. Do you know? |
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
I recently ran into this issue while trying to modify the acceptors for
|
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
Version of AWS SDK for Go?
v1.17.6
Version of Go (
go version
)?go version go1.11.2 darwin/amd64
What issue did you see?
I'm writing a custom
WaitUntilXXX
function for my operation tool and found thatrequest.WaiterAcceptor.Matcher
does not work with JMESPath's comparison operators (such as==
)http://jmespath.org/specification.html#comparison-operators
This issue occurs if one operand is an attribute of AWS API response and the other is a literal value.
That is, we cannot use the filter expression something like this:
I wrote a unit test to clarify what I expect. See the attached at the end.
As you can see, the
(* WaiterAcceptor) match
function usesawsutil.ValuesAtPath
.aws-sdk-go/aws/request/waiter.go
Line 233 in 5b6de26
It depends on the go-jmespath library which says fully compliant with the JMESPath specification.
aws-sdk-go/aws/awsutil/path_value.go
Line 159 in 5b6de26
Therefore, the
request.WaiterAcceptor.Matcher
seems to support JMESPath expressions, but this does not work as expected, and I feel this counterintuitive.Debugging for a while, I probably found the cause.
Because most of the AWS API response attributes in the aws-sdk-go are pointer references, I think that comparing a pointer of string with a string will never be equal.
If my understanding is correct,
(* AutoScaling) WaitUntilGroupInServiceWithContex
is probably affected by this issue and does not work correctly.aws-sdk-go/service/autoscaling/waiters.go
Line 87 in 5b6de26
Interestingly,
(* ECS) WaitUntilServicesStableWithContext
does not seem to have this problem.aws-sdk-go/service/ecs/waiters.go
Line 102 in 5b6de26
I searched for related issues and found the followings:
As in #457's comment (jmespath/go-jmespath#15 (comment)),
this problem was fixed in jmespath/go-jmespath#15 , but it was reverted in jmespath/go-jmespath#20 .
It is also said that #457 was fixed in jmespath/go-jmespath#18 , but after that, it looks like jmespath/go-jmespath#15 has not been resolved yet.
However, these issues were closed 3 years ago and I'm not sure what is the current state.
Steps to reproduce
Save this code as
main_test.go
and rungo test -v
:Thanks!
The text was updated successfully, but these errors were encountered: