This commit is contained in:
Peter Eckersley 2016-06-16 18:18:33 -07:00
parent 9459daa6d0
commit efd1ff46c6
4 changed files with 6 additions and 10 deletions

View file

@ -1,5 +1,6 @@
"""Very low-level nginx config parser based on pyparsing."""
import copy
import logging
import string
from pyparsing import (
@ -8,6 +9,7 @@ from pyparsing import (
from pyparsing import stringEnd
from pyparsing import restOfLine
logger = logging.getLogger(__name__)
class RawNginxParser(object):
# pylint: disable=expression-not-assigned
@ -97,11 +99,7 @@ class RawNginxDumper(object):
# if so rotate it into gap
if values and spacey(values):
gap = values
try:
values = b.pop(0)
except:
import ipdb
ipdb.set_trace()
values = b.pop(0)
#if values is None:
# yield indentation + key + gap + ';'
#else:
@ -200,7 +198,7 @@ class UnspacedList(list):
self.spaced.extend(x.spaced)
else:
self.spaced.extend(x)
self.logger.debug("Weird, extending regular list %r to Unspaced %r", x, self)
logger.debug("Weird, extending regular list %r to Unspaced %r", x, self)
list.extend(self, x)
def __add__(self, other):

View file

@ -4,7 +4,6 @@ import logging
import os
import pyparsing
import re
import sys
from certbot import errors

View file

@ -1,5 +1,6 @@
"""Test for certbot_nginx.nginxparser."""
import operator
import os
import unittest
from pyparsing import ParseException

View file

@ -3,7 +3,6 @@
import itertools
import logging
import os
import sys
from certbot import errors
from certbot.plugins import common
@ -124,8 +123,7 @@ class NginxTlsSni01(common.TLSSNI01):
True, self.challenge_conf)
with open(self.challenge_conf, "w") as new_conf:
out = nginxparser.dumps(config)
new_conf.write(out)
nginxparser.dump(config, new_conf)
def _make_server_block(self, achall, addrs):
"""Creates a server block for a challenge.