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

Check if LoadBalancerName is set #468

Merged
merged 8 commits into from
Jun 14, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion senza/components/elastic_load_balancer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def component_elastic_load_balancer_v2(definition,
health_check_path = configuration.get("HealthCheckPath") or '/health'
health_check_port = configuration.get("HealthCheckPort") or configuration["HTTPPort"]

if configuration.get('NameSuffix'):
if configuration.get('LoadBalancerName'):
loadbalancer_name = get_load_balancer_name(configuration["LoadBalancerName"], info["StackVersion"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe confusing that LoadBalancerName is now suffixed with StackVersion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhh, true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write a new function for this? I don't like to create the same line into a new function.

def get_load_balancer_name(stack_name: str, stack_version: str):

is not working correct and after truncating, there is a possibility that you've a "--"

example:

test-loadbalancer-name-long-red-staging -> test-loadbalancer-name-long-red-[-version]

test-loadbalancer-name-long-red-staging 100 -> test-loadbalancer-name-long--100

(maybe the length of the example is not 100% correct but it show's what i mean).

elif configuration.get('NameSuffix'):
version = '{}-{}'.format(info["StackVersion"],
configuration['NameSuffix'])
loadbalancer_name = get_load_balancer_name(info["StackName"], version)
Expand Down