-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
elb_classic_lb: ensure stickiness expiration is an int before comparison - fixes #27309 #27328
Conversation
37ab78a
to
bf682aa
Compare
@@ -1063,7 +1063,10 @@ def select_stickiness_policy(self): | |||
if 'expiration' not in self.stickiness: | |||
self.module.fail_json(msg='expiration must be set when type is loadbalancer') | |||
|
|||
expiration = self.stickiness['expiration'] if self.stickiness['expiration'] is not 0 else None | |||
try: | |||
expiration = self.stickiness['expiration'] if int(self.stickiness['expiration']) else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need expiration to be an int type as well or is it okay if it is a string repesentation (like: "10" )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ie: if self.stickiness['expiration'] is the string "10", the change being made does the comparison of self.stickiness['expiration'] as the int 10, but the variable expiration is set to the string "10".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. String representation works as expected. The comparison casts them to strings.
Cool. +1 to merge.
|
merged to devel. Feel free to cherry-pick if you think it's needed in 2.3.x. |
SUMMARY
Expiration should be an int. Fixes #27309
ISSUE TYPE
COMPONENT NAME
lib/ansible/modules/cloud/amazon/elb_classic_lb.py
ANSIBLE VERSION