From be628544f8be8eedf922f6c747d636c38c66a128 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Wed, 4 Oct 2017 12:30:45 -0700 Subject: [PATCH] don't add vhosts twice --- certbot-nginx/certbot_nginx/configurator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/certbot-nginx/certbot_nginx/configurator.py b/certbot-nginx/certbot_nginx/configurator.py index fc1985654..d9e440c8a 100644 --- a/certbot-nginx/certbot_nginx/configurator.py +++ b/certbot-nginx/certbot_nginx/configurator.py @@ -271,14 +271,15 @@ class NginxConfigurator(common.Installer): def _get_default_vhost(self): vhost_list = self.parser.get_vhosts() # if one has default_server set, return that one - default_vhosts = [] + default_vhosts = set() for vhost in vhost_list: for addr in vhost.addrs: if addr.default: - default_vhosts.append(vhost) + default_vhosts.add(vhost) + break if len(default_vhosts) == 1: - return default_vhosts[0] + return next(iter(default_vhosts)) # TODO: present a list of vhosts for user to choose from