Handle dict extras in Voluptuous Schema

Not sure if schema requirements changed but it is no longer valid to
use:

  Schema({}, extra=True)

The docs say that should be avoided and instead you should use:

  Schema(dict)

To indicate a dict that can have any key: value pairs. Additionally
extra=True appears to be replaced with extra=ALLOW_EXTRA so update that
in cases where we have some subset of desired keys.

Change-Id: I3dc966dae534416f2b601ec8d299e1d0e3651e7b
This commit is contained in:
Clark Boylan
2017-04-12 09:00:29 -07:00
parent 621ec9a22b
commit 3acb7ba02a
8 changed files with 9 additions and 9 deletions

View File

@@ -582,7 +582,7 @@ class PipelineParser(object):
'email': str,
'older-than': str,
'newer-than': str,
}, extra=True)
}, extra=vs.ALLOW_EXTRA)
require = {'approval': to_list(approval),
'open': bool,

View File

@@ -819,5 +819,5 @@ class GerritConnection(BaseConnection):
def getSchema():
gerrit_connection = v.Any(str, v.Schema({}, extra=True))
gerrit_connection = v.Any(str, v.Schema(dict))
return gerrit_connection

View File

@@ -48,5 +48,5 @@ class GerritReporter(BaseReporter):
def getSchema():
gerrit_reporter = v.Any(str, v.Schema({}, extra=True))
gerrit_reporter = v.Any(str, v.Schema(dict))
return gerrit_reporter

View File

@@ -82,14 +82,14 @@ def validate_conf(trigger_conf):
def getSchema():
def toList(x):
return v.Any([x], x)
variable_dict = v.Schema({}, extra=True)
variable_dict = v.Schema(dict)
approval = v.Schema({'username': str,
'email-filter': str,
'email': str,
'older-than': str,
'newer-than': str,
}, extra=True)
}, extra=v.ALLOW_EXTRA)
gerrit_trigger = {
v.Required('event'):

View File

@@ -59,5 +59,5 @@ class GitConnection(BaseConnection):
def getSchema():
git_connection = v.Any(str, v.Schema({}, extra=True))
git_connection = v.Any(str, v.Schema(dict))
return git_connection

View File

@@ -58,5 +58,5 @@ class SMTPConnection(BaseConnection):
def getSchema():
smtp_connection = v.Any(str, v.Schema({}, extra=True))
smtp_connection = v.Any(str, v.Schema(dict))
return smtp_connection

View File

@@ -101,5 +101,5 @@ class SQLConnection(BaseConnection):
def getSchema():
sql_connection = v.Any(str, v.Schema({}, extra=True))
sql_connection = v.Any(str, v.Schema(dict))
return sql_connection

View File

@@ -63,7 +63,7 @@ def getSchema():
'email': str,
'older-than': str,
'newer-than': str,
}, extra=True)
}, extra=v.ALLOW_EXTRA)
zuul_trigger = {
v.Required('event'):