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
fixed tf tests: TestAccRoute53HealthCheck #5241
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,10 +64,26 @@ def __init__(self, health_check_id, caller_reference, health_check_args): | |
self.measure_latency = health_check_args.get("measure_latency") or False | ||
self.inverted = health_check_args.get("inverted") or False | ||
self.disabled = health_check_args.get("disabled") or False | ||
self.enable_sni = health_check_args.get("enable_sni") or False | ||
self.children = health_check_args.get("children") or None | ||
self.enable_sni = health_check_args.get("enable_sni") or True | ||
self.caller_reference = caller_reference | ||
|
||
def add_children(self, children): | ||
if children and isinstance(children, list): | ||
self.children = children | ||
elif children and isinstance(children, str): | ||
self.children = [children] | ||
else: | ||
self.children = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this desired behaviour? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. if calling But it will overwrite all children if |
||
return self.children | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The return value is not used anywhere, as far as I can tell, so we can remove this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. Missed it. Thanks for pointing out. |
||
|
||
def add_regions(self, regions): | ||
bblommers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if regions and isinstance(regions, list): | ||
self.regions = regions | ||
elif regions and isinstance(regions, str): | ||
self.regions = [regions] | ||
else: | ||
self.regions = None | ||
bblommers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@property | ||
def physical_resource_id(self): | ||
return self.id | ||
|
@@ -135,10 +151,17 @@ def to_xml(self): | |
{% if health_check.children %} | ||
<ChildHealthChecks> | ||
{% for child in health_check.children %} | ||
<member>{{ child }}</member> | ||
<ChildHealthCheck>{{ child }}</ChildHealthCheck> | ||
{% endfor %} | ||
</ChildHealthChecks> | ||
{% endif %} | ||
{% if health_check.regions %} | ||
<Regions> | ||
{% for region in health_check.regions %} | ||
<Region>{{ region }}</Region> | ||
{% endfor %} | ||
</Regions> | ||
{% endif %} | ||
</HealthCheckConfig> | ||
<HealthCheckVersion>1</HealthCheckVersion> | ||
</HealthCheck>""" | ||
|
@@ -617,9 +640,43 @@ def update_hosted_zone_comment(self, id_, comment): | |
def create_health_check(self, caller_reference, health_check_args): | ||
health_check_id = str(uuid.uuid4()) | ||
health_check = HealthCheck(health_check_id, caller_reference, health_check_args) | ||
health_check.add_children(health_check_args.get("children")) | ||
health_check.add_regions(health_check_args.get("regions")) | ||
self.health_checks[health_check_id] = health_check | ||
return health_check | ||
|
||
def update_health_check(self, health_check_id, health_check_args): | ||
health_check = self.health_checks.get(health_check_id) | ||
if not health_check: | ||
raise NoSuchHealthCheck() | ||
|
||
if health_check_args.get("ip_address"): | ||
health_check.ip_address = health_check_args.get("ip_address") | ||
if health_check_args.get("port"): | ||
health_check.port = health_check_args.get("port") | ||
if health_check_args.get("resource_path"): | ||
health_check.resource_path = health_check_args.get("resource_path") | ||
if health_check_args.get("fqdn"): | ||
health_check.fqdn = health_check_args.get("fqdn") | ||
if health_check_args.get("search_string"): | ||
health_check.search_string = health_check_args.get("search_string") | ||
if health_check_args.get("request_interval"): | ||
health_check.request_interval = health_check_args.get("request_interval") | ||
if health_check_args.get("failure_threshold"): | ||
health_check.failure_threshold = health_check_args.get("failure_threshold") | ||
if health_check_args.get("health_threshold"): | ||
health_check.health_threshold = health_check_args.get("health_threshold") | ||
if health_check_args.get("inverted"): | ||
health_check.inverted = health_check_args.get("inverted") | ||
if health_check_args.get("disabled"): | ||
health_check.disabled = health_check_args.get("disabled") | ||
if health_check_args.get("enable_sni"): | ||
health_check.enable_sni = health_check_args.get("enable_sni") | ||
health_check.add_children(health_check_args.get("children")) | ||
health_check.add_regions(health_check_args.get("regions")) | ||
|
||
return health_check | ||
|
||
def list_health_checks(self): | ||
return self.health_checks.values() | ||
|
||
|
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.
The name
set_children
would be more accurate, as it doesn't add anything to the existing list of childrenThere 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.
Agreed. Updated