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: Ia9f4d535b9b633e703465f155c4722d9a58c45a7
This commit is contained in:
Clark Boylan 2017-04-12 08:54:08 -07:00
parent 1713ee675c
commit 0a38b6c568
7 changed files with 8 additions and 8 deletions

View File

@ -494,5 +494,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

@ -59,5 +59,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

@ -100,5 +100,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

@ -39,7 +39,7 @@ class LayoutSchema(object):
'email': str,
'older-than': str,
'newer-than': str,
}, extra=True)
}, extra=v.ALLOW_EXTRA)
require = {'approval': toList(approval),
'open': bool,

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

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