mirror of
https://github.com/certbot/certbot.git
synced 2026-06-07 15:52:08 -04:00
Address @kuba review comments
This commit is contained in:
parent
6f4af62f61
commit
cf48791686
2 changed files with 13 additions and 18 deletions
|
|
@ -1,4 +1,5 @@
|
|||
"""NginxDVSNI"""
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
|
||||
|
|
@ -103,9 +104,8 @@ class NginxDvsni(ApacheDvsni):
|
|||
'LetsEncrypt could not find an HTTP block to include DVSNI '
|
||||
'challenges in %s.' % root)
|
||||
|
||||
config = []
|
||||
for idx, addrs in enumerate(ll_addrs):
|
||||
config.append(self._make_server_block(self.achalls[idx], addrs))
|
||||
config = [self._make_server_block(pair[0], pair[1])
|
||||
for pair in itertools.izip(self.achalls, ll_addrs)]
|
||||
|
||||
self.configurator.reverter.register_file_creation(
|
||||
True, self.challenge_conf)
|
||||
|
|
@ -126,17 +126,15 @@ class NginxDvsni(ApacheDvsni):
|
|||
:rtype: list
|
||||
|
||||
"""
|
||||
block = []
|
||||
for addr in addrs:
|
||||
block.append(['listen', str(addr)])
|
||||
|
||||
block.append(['server_name', achall.nonce_domain])
|
||||
block.append(['include', self.configurator.parser.loc["ssl_options"]])
|
||||
block.append(['ssl_certificate', self.get_cert_file(achall)])
|
||||
block.append(['ssl_certificate_key', achall.key.file])
|
||||
|
||||
document_root = os.path.join(
|
||||
self.configurator.config.config_dir, "dvsni_page")
|
||||
block.append([['location', '/'], [['root', document_root]]])
|
||||
|
||||
block = [['listen', str(addr)] for addr in addrs]
|
||||
|
||||
block.extend([['server_name', achall.nonce_domain],
|
||||
['include', self.configurator.parser.loc["ssl_options"]],
|
||||
['ssl_certificate', self.get_cert_file(achall)],
|
||||
['ssl_certificate_key', achall.key.file],
|
||||
[['location', '/'], [['root', document_root]]]])
|
||||
|
||||
return [['server'], block]
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class DvsniPerformTest(util.NginxTest):
|
|||
def test_perform(self, mock_save):
|
||||
self.sni.add_chall(self.achalls[1])
|
||||
responses = self.sni.perform()
|
||||
self.assertEqual(None, responses)
|
||||
self.assertTrue(responses is None)
|
||||
self.assertEqual(mock_save.call_count, 1)
|
||||
|
||||
def test_perform0(self):
|
||||
|
|
@ -153,10 +153,7 @@ class DvsniPerformTest(util.NginxTest):
|
|||
self.assertTrue(['include', self.sni.challenge_conf] in http[1])
|
||||
|
||||
vhosts = self.sni.configurator.parser.get_vhosts()
|
||||
vhs = []
|
||||
for vhost in vhosts:
|
||||
if vhost.filep == self.sni.challenge_conf:
|
||||
vhs.append(vhost)
|
||||
vhs = [vh for vh in vhosts if vh.filep == self.sni.challenge_conf]
|
||||
|
||||
for vhost in vhs:
|
||||
if vhost.addrs == set(v_addr1):
|
||||
|
|
|
|||
Loading…
Reference in a new issue