-
-
Save hackndoes/619b9000dd75c558b352f2709520d3ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if self.stickiness['type'] == 'loadbalancer': | |
policy = [] | |
policy_type = 'LBCookieStickinessPolicyType' | |
if self.module.boolean(self.stickiness['enabled']): | |
if 'expiration' not in self.stickiness: | |
self.module.fail_json(msg='expiration must be set when type is loadbalancer') | |
# self.stickiness['expiration'] is "0" and not 0 thus not set to None and fails submit to AWS | |
expiration = self.stickiness['expiration'] if self.stickiness['expiration'] is not 0 else None | |
policy_attrs = { | |
'type': policy_type, | |
'attr': 'lb_cookie_stickiness_policies', | |
'method': 'create_lb_cookie_stickiness_policy', | |
'dict_key': 'cookie_expiration_period', | |
'param_value': expiration | |
} | |
policy.append(self._policy_name(policy_attrs['type'])) | |
self._set_stickiness_policy(elb_info, listeners_dict, policy, **policy_attrs) | |
elif not self.module.boolean(self.stickiness['enabled']): | |
if len(elb_info.policies.lb_cookie_stickiness_policies): | |
if elb_info.policies.lb_cookie_stickiness_policies[0].policy_name == self._policy_name(policy_type): | |
self.changed = True | |
else: | |
self.changed = False | |
self._set_listener_policy(listeners_dict) | |
self._delete_policy(self.elb.name, self._policy_name(policy_type)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment