1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

Allow empty nginx blocks (#4555)

* modify test config file to allow valid config that fails to parse in parser.py

* make failing tests pass by fixing the problem
This commit is contained in:
ohemorange
2017-04-26 18:44:06 -07:00
committed by Brad Warren
parent 5f9c6539d5
commit 1611df4120
3 changed files with 7 additions and 4 deletions

View File

@@ -110,7 +110,7 @@ class NginxParser(object):
srv = servers[filename] # workaround undefined loop var in lambdas
# Find all the server blocks
_do_for_subarray(tree, lambda x: x[0] == ['server'],
_do_for_subarray(tree, lambda x: len(x) >= 2 and x[0] == ['server'],
lambda x, y: srv.append((x[1], y)))
# Find 'include' statements in server blocks and append their trees

View File

@@ -125,13 +125,13 @@ class NginxParserTest(util.NginxTest):
False, True,
set(['localhost',
r'~^(www\.)?(example|bar)\.']),
[], [9, 1, 9])
[], [10, 1, 9])
vhost2 = obj.VirtualHost(nparser.abs_path('nginx.conf'),
[obj.Addr('somename', '8080', False, False),
obj.Addr('', '8000', False, False)],
False, True,
set(['somename', 'another.alias', 'alias']),
[], [9, 1, 12])
[], [10, 1, 12])
vhost3 = obj.VirtualHost(nparser.abs_path('sites-enabled/example.com'),
[obj.Addr('69.50.225.155', '9000',
False, False),
@@ -186,7 +186,7 @@ class NginxParserTest(util.NginxTest):
None, None, None,
set(['localhost',
r'~^(www\.)?(example|bar)\.']),
None, [9, 1, 9])
None, [10, 1, 9])
nparser.add_server_directives(mock_vhost,
[['foo', 'bar'], ['\n ', 'ssl_certificate', ' ',
'/etc/ssl/cert.pem']],

View File

@@ -14,6 +14,9 @@ events {
worker_connections 1024;
}
empty {
}
include foo.conf;
http {