Specify option type in _allow_extra
This commit is contained in:
parent
5371be2b39
commit
8e3465b5d4
@ -81,6 +81,10 @@ def list_of_ip_address(value):
|
|||||||
return [ip_address(s.strip()) for s in value.split(",")]
|
return [ip_address(s.strip()) for s in value.split(",")]
|
||||||
|
|
||||||
|
|
||||||
|
def unspecified_type(value):
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
def _convert_to_bool(value):
|
def _convert_to_bool(value):
|
||||||
if value.lower() not in RawConfigParser.BOOLEAN_STATES:
|
if value.lower() not in RawConfigParser.BOOLEAN_STATES:
|
||||||
raise ValueError("Not a boolean: %r" % value)
|
raise ValueError("Not a boolean: %r" % value)
|
||||||
@ -204,7 +208,7 @@ DEFAULT_CONFIG_SCHEMA = OrderedDict([
|
|||||||
"help": "mask passwords in logs",
|
"help": "mask passwords in logs",
|
||||||
"type": bool})])),
|
"type": bool})])),
|
||||||
("headers", OrderedDict([
|
("headers", OrderedDict([
|
||||||
("_allow_extra", True)])),
|
("_allow_extra", str)])),
|
||||||
("_internal", OrderedDict([
|
("_internal", OrderedDict([
|
||||||
("filesystem_fsync", {
|
("filesystem_fsync", {
|
||||||
"value": "True",
|
"value": "True",
|
||||||
@ -321,15 +325,14 @@ class Configuration:
|
|||||||
"Invalid section %r in %s" % (section, source))
|
"Invalid section %r in %s" % (section, source))
|
||||||
new_values[section] = {}
|
new_values[section] = {}
|
||||||
extra_type = None
|
extra_type = None
|
||||||
if self._schema[section].get("_allow_extra"):
|
extra_type = self._schema[section].get("_allow_extra")
|
||||||
extra_type = str
|
|
||||||
if "type" in self._schema[section]:
|
if "type" in self._schema[section]:
|
||||||
if "type" in config[section]:
|
if "type" in config[section]:
|
||||||
plugin = config[section]["type"]
|
plugin = config[section]["type"]
|
||||||
else:
|
else:
|
||||||
plugin = self.get(section, "type")
|
plugin = self.get(section, "type")
|
||||||
if plugin not in self._schema[section]["type"]["internal"]:
|
if plugin not in self._schema[section]["type"]["internal"]:
|
||||||
extra_type = str
|
extra_type = unspecified_type
|
||||||
for option in config[section]:
|
for option in config[section]:
|
||||||
type_ = extra_type
|
type_ = extra_type
|
||||||
if option in self._schema[section]:
|
if option in self._schema[section]:
|
||||||
|
Loading…
Reference in New Issue
Block a user