diff --git a/slapos/recipe/apache_frontend/__init__.py b/slapos/recipe/apache_frontend/__init__.py index c6a9de55f84c8d228cf7c749b7bd076b6a18d923..ac6defb87f26e64338c6c939d16dc3d799900b5d 100644 --- a/slapos/recipe/apache_frontend/__init__.py +++ b/slapos/recipe/apache_frontend/__init__.py @@ -81,6 +81,9 @@ class Recipe(BaseSlapRecipe): slave_instance_list = sorted(slave_instance_list, key=operator.itemgetter('slave_reference')) + # dict of used domains, only used to track duplicates + domain_dict = {} + for slave_instance in slave_instance_list: backend_url = slave_instance.get("url", None) reference = slave_instance.get("slave_reference") @@ -106,6 +109,12 @@ class Recipe(BaseSlapRecipe): domain = "%s.%s" % (reference.replace("-", "").lower(), frontend_domain_name) + if domain_dict.get(domain): + # This domain already has been processed, skip this new one + continue + else: + domain_dict[domain] = True + # Define the URL where the instance will be available # WARNING: we use default ports (443, 80) here. slave_dict[reference] = "%s%s/" % (scheme, domain)