fix bug lp:1025526,update iniparser.py to accept empty value.

also,this patch turn off pep8 E125 check,this for now seems to
be unnecessary,it check continuous line split.and update the
latest openstack-common https://review.openstack.org/#/c/9201
which has fix pep8 1.3 issue except for E125 check.

Change-Id: I86e6a3add56a0a2941031a1248f1696667ac56b8
This commit is contained in:
Yaguang Tang 2012-07-17 13:23:00 +08:00
parent b7501f2be1
commit 5fcf6ccd95
11 changed files with 42 additions and 44 deletions

View File

@ -53,7 +53,8 @@ class BaseParser(object):
key, value = line[:colon], line[colon + 1:] key, value = line[:colon], line[colon + 1:]
value = value.strip() value = value.strip()
if value[0] == value[-1] and value[0] == "\"" or value[0] == "'": if ((value and value[0] == value[-1]) and
(value[0] == "\"" or value[0] == "'")):
value = value[1:-1] value = value[1:-1]
return key.strip(), [value] return key.strip(), [value]

View File

@ -89,7 +89,7 @@ log_opts = [
default='[instance: %(uuid)s] ', default='[instance: %(uuid)s] ',
help='If an instance UUID is passed with the log message, ' help='If an instance UUID is passed with the log message, '
'format it like this'), 'format it like this'),
] ]
generic_log_opts = [ generic_log_opts = [
@ -105,7 +105,7 @@ generic_log_opts = [
cfg.StrOpt('logfile_mode', cfg.StrOpt('logfile_mode',
default='0644', default='0644',
help='Default file mode used when creating log files'), help='Default file mode used when creating log files'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
@ -208,9 +208,9 @@ class JSONFormatter(logging.Formatter):
def formatException(self, ei, strip_newlines=True): def formatException(self, ei, strip_newlines=True):
lines = traceback.format_exception(*ei) lines = traceback.format_exception(*ei)
if strip_newlines: if strip_newlines:
lines = [itertools.ifilter(lambda x: x, lines = [itertools.ifilter(
line.rstrip().splitlines()) lambda x: x,
for line in lines] line.rstrip().splitlines()) for line in lines]
lines = list(itertools.chain(*lines)) lines = list(itertools.chain(*lines))
return lines return lines

View File

@ -37,7 +37,7 @@ notifier_opts = [
cfg.StrOpt('default_publisher_id', cfg.StrOpt('default_publisher_id',
default='$host', default='$host',
help='Default publisher_id for outgoing notifications'), help='Default publisher_id for outgoing notifications'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
CONF.register_opts(notifier_opts) CONF.register_opts(notifier_opts)

View File

@ -19,7 +19,8 @@ from quantum.openstack.common import importutils
from quantum.openstack.common import log as logging from quantum.openstack.common import log as logging
list_notifier_drivers_opt = cfg.MultiStrOpt('list_notifier_drivers', list_notifier_drivers_opt = cfg.MultiStrOpt(
'list_notifier_drivers',
default=['quantum.openstack.common.notifier.no_op_notifier'], default=['quantum.openstack.common.notifier.no_op_notifier'],
help='List of drivers to send notifications') help='List of drivers to send notifications')

View File

@ -22,8 +22,8 @@ from quantum.openstack.common import rpc
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
notification_topic_opt = cfg.ListOpt('notification_topics', notification_topic_opt = cfg.ListOpt(
default=['notifications', ], 'notification_topics', default=['notifications', ],
help='AMQP topic used for openstack notifications') help='AMQP topic used for openstack notifications')
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -98,13 +98,9 @@ function run_pep8 {
echo "Running pep8 ..." echo "Running pep8 ..."
PEP8_EXCLUDE="vcsversion.py,*.pyc" PEP8_EXCLUDE="vcsversion.py,*.pyc"
# TODO(gongysh) we should pep8 check openstack common files. But that project does # we now turn off pep8 1.3 E125 check to avoid make change to
# not stick to latest pep8 version. Therefore we exclude these common files here. # openstack-common .
# Pep8 does not support exclude in the format quantum/openstack/common, PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --ignore=E125 --repeat --show-source"
# so I have to exclude some of openstack common files one by one. This also applies
# to tox.ini.
PEP8_EXCLUDE="$PEP8_EXCLUDE,log.py,notifier,rpc"
PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat --show-source"
PEP8_INCLUDE="bin/* quantum run_tests.py setup*.py" PEP8_INCLUDE="bin/* quantum run_tests.py setup*.py"
${wrapper} pep8 $PEP8_OPTIONS $PEP8_INCLUDE ${wrapper} pep8 $PEP8_OPTIONS $PEP8_INCLUDE
} }

View File

@ -21,7 +21,7 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
deps = pep8 deps = pep8
setuptools_git>=0.4 setuptools_git>=0.4
commands = pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc,*egg,log.py,notifier,rpc . commands = pep8 --repeat --show-source --ignore=E125 --exclude=.venv,.tox,dist,doc,*egg .
[testenv:cover] [testenv:cover]
setenv = NOSE_WITH_COVERAGE=1 setenv = NOSE_WITH_COVERAGE=1