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

questions regarding autoscaling waiter conditions #1109

Closed
quiver opened this issue Feb 28, 2016 · 5 comments
Closed

questions regarding autoscaling waiter conditions #1109

quiver opened this issue Feb 28, 2016 · 5 comments
Assignees

Comments

@quiver
Copy link

quiver commented Feb 28, 2016

I was about to implement autoscaling waiters for aws-cli and found that you've recently implemented it.
I have questions about specifications of autoscaling waiters, more specifically, acceptors conditions for success cases.
(I've just copied ruby-sdk's autoscaling waiter JSON to aws-cli source tree and tested from aws-cli, not from ruby-sdk.)

GroupExists API

condition

{
  "argument": "length(AutoScalingGroups)",
  "expected": 1,
  "matcher": "pathAll",
  "state": "success"
},

"length(AutoScalingGroups)" returns a scalar value and mather pathAll expects list arguments.

I think this should be

{
  "argument": "length(AutoScalingGroups)",
  "expected": 1,
  "matcher": "path",  // CHANGED
  "state": "success"
}

Same for GroupNotExists API.

GroupInService API

condition

Success condition is that ASG has at least MinSize InService instances.

{
  "argument": "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)",
  "expected": false,
  "matcher": "pathAll",
  "state": "success"
},

AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][] returns a list and contains(AutoScaling ...) returns a boolean value, but mather pathAll expects list arguments.

I think this should be

{
  "argument": "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)",
  "expected": false,
  "matcher": "path",
  "state": "success"
},

or

{
  "argument": "AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][]",
  "expected": true,
  "matcher": "pathAll",
  "state": "success"
}

My revised autoscaling waiter.json and a DescribeAutoScalingGroups sample output file can be found here https://gist.github.com/quiver/fca4dc97d7d5be04cf79#file-waiters-2-json.

Or am I missing something?

@awood45
Copy link
Member

awood45 commented Feb 29, 2016

I'm going to check if there is any unexpected behavior from the waiters as written. I do know that some matcher types end up behaving in de facto the same manner, so it may not be an issue (even if not semantically optimal). I don't recall off the top of my head (returning from vacation too) which matchers are which, so I'll be looking at differences in behavior if any.

@awood45
Copy link
Member

awood45 commented Feb 29, 2016

This is a good catch - the waiter will likely just cycle on false for a scalar with a pathAll matcher.

I'm already going to be touching Auto Scaling resources to fix another bug, so I will test and push the fix for this - no need for a PR, unless it's already done and tested.

@awood45 awood45 self-assigned this Feb 29, 2016
@quiver
Copy link
Author

quiver commented Mar 1, 2016

@awood45

I'm already going to be touching Auto Scaling resources to fix another bug, so I will test and push the fix for this - no need for a PR, unless it's already done and tested.

I don't have a work-in-progress PR, so please do.
Thank you for your quick response. I really need this feature!

awood45 added a commit that referenced this issue Mar 1, 2016
@awood45
Copy link
Member

awood45 commented Mar 1, 2016

I've written a fix for this that will work in the case of requesting exactly one Auto Scaling group. Unfortunately, due to waiter/JMESPath limitations, if you have multiple Auto Scaling groups in a single request, something like :group_exists will return a success response if at least one group exists.

You can avoid this by always specifying a single group in your waiter requests.

@awood45 awood45 closed this as completed Mar 1, 2016
awood45 added a commit that referenced this issue Mar 1, 2016
@quiver
Copy link
Author

quiver commented Mar 2, 2016

👏

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

No branches or pull requests

2 participants