config: Reassemble strings sensibly
If a string-based configuation entry had whitespace in it, it would be
reassembled via a round-trip through the python interpreter, resulting
in a line like this:
PidFile /home/dkimpy-milter/pid file
produces a string like "['/home/dkimpy-milter/pid', 'file']", which is
clearly wrong.
I don't want to encourage people to use paths or other strings with
whitespace in them, but if we're going to fail on them we should be
failing explicitly, not doing a weird transformation that will just
break.
This is concretely useful for the DNSOverride mechanism, which is
where i ran into the problem when trying to set up testing that could
work without setting up an emulated DNS system.
This commit is contained in:
@@ -390,7 +390,10 @@ def _readConfigFile(path, configData=None, configGlobal={}):
|
|||||||
if conversion == 'bool':
|
if conversion == 'bool':
|
||||||
configData[name] = _find_boolean(value)
|
configData[name] = _find_boolean(value)
|
||||||
elif conversion == 'str':
|
elif conversion == 'str':
|
||||||
configData[name] = str(value)
|
if isinstance(value, list):
|
||||||
|
configData[name] = line.split(None, 1)[1]
|
||||||
|
else:
|
||||||
|
configData[name] = str(value)
|
||||||
elif conversion == 'int':
|
elif conversion == 'int':
|
||||||
configData[name] = int(value)
|
configData[name] = int(value)
|
||||||
elif conversion == 'dataset':
|
elif conversion == 'dataset':
|
||||||
|
|||||||
Reference in New Issue
Block a user