Address review nits

This commit is contained in:
Erica Portnoy 2017-10-12 17:14:30 -07:00
parent 3a94e8cac9
commit c8202dbfb4
3 changed files with 5 additions and 4 deletions

View file

@ -266,7 +266,7 @@ class NginxConfigurator(common.Installer):
self.new_vhost.names = set()
self.new_vhost.names.add(domain)
name_block = [['\n ', 'server_name', ' ', " ".join(self.new_vhost.names)]]
name_block = [['\n ', 'server_name', ' ', ' '.join(self.new_vhost.names)]]
self.parser.add_server_directives(self.new_vhost, name_block, replace=True)
return self.new_vhost

View file

@ -2,12 +2,12 @@
# Forked from https://github.com/fatiherikli/nginxparser (MIT Licensed)
import copy
import logging
import six
from pyparsing import (
Literal, White, Forward, Group, Optional, OneOrMore, QuotedString, Regex, ZeroOrMore, Combine)
from pyparsing import stringEnd
from pyparsing import restOfLine
import six
logger = logging.getLogger(__name__)

View file

@ -5,6 +5,7 @@ import logging
import os
import pyparsing
import re
import six
from certbot import errors
@ -322,7 +323,7 @@ class NginxParser(object):
:returns: A vhost object for the newly created vhost
:rtype: :class:`~certbot_nginx.obj.VirtualHost`
"""
# TODO: do the right thing for debian
# TODO: https://github.com/certbot/certbot/issues/5185
# put it in the same file as the template, at the same level
enclosing_block = self.parsed[vhost_template.filep]
for index in vhost_template.path[:-1]:
@ -588,7 +589,7 @@ def _add_directive(block, directive, replace):
directive_name = directive[0]
def can_append(loc, dir_name):
""" Can we append this directive to the block? """
return loc is None or (isinstance(dir_name, six.string_types)\
return loc is None or (isinstance(dir_name, six.string_types)
and dir_name in REPEATABLE_DIRECTIVES)
err_fmt = 'tried to insert directive "{0}" but found conflicting "{1}".'