Skip to content

Commit

Permalink
added prefix and multi lb support (for #109)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxlife committed Sep 21, 2015
1 parent a2fbba4 commit 1f6e7d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions senza/components/auto_scaling_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ def component_auto_scaling_group(definition, configuration, args, info, force, a
default_health_check_type = 'EC2'

if "ElasticLoadBalancer" in configuration:
definition["Resources"][asg_name]["Properties"]["LoadBalancerNames"] = [
{"Ref": configuration["ElasticLoadBalancer"]}]
if isinstance(configuration["ElasticLoadBalancer"], str):
definition["Resources"][asg_name]["Properties"]["LoadBalancerNames"] = [
{"Ref": configuration["ElasticLoadBalancer"]}]
elif isinstance(configuration["ElasticLoadBalancer"], list):
definition["Resources"][asg_name]["Properties"]["LoadBalancerNames"] = []
for ref in configuration["ElasticLoadBalancer"]:
definition["Resources"][asg_name]["Properties"]["LoadBalancerNames"].append({'Ref': ref})
# use ELB health check by default
default_health_check_type = 'ELB'

Expand Down
7 changes: 6 additions & 1 deletion senza/components/elastic_load_balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ def component_elastic_load_balancer(definition, configuration, args, info, force
health_check_port = configuration["HealthCheckPort"]

health_check_target = "{0}:{1}{2}".format(health_check_protocol, health_check_port, health_check_path)
loadbalancer_name = get_load_balancer_name(info["StackName"], info["StackVersion"])
if configuration.get('NameSufix'):
loadbalancer_name = get_load_balancer_name(info["StackName"], '{}-{}'.format(info["StackVersion"],
configuration['NameSufix']))
del(configuration['NameSufix'])
else:
loadbalancer_name = get_load_balancer_name(info["StackName"], info["StackVersion"])

loadbalancer_scheme = "internal"
allowed_loadbalancer_schemes = ("internet-facing", "internal")
Expand Down

0 comments on commit 1f6e7d2

Please sign in to comment.