Added type check to alarm definition schema

Change-Id: I4df90a9cbd67ee95be80b061d494fae3bc6e1307
This commit is contained in:
Joe Keen 2015-11-04 17:08:16 -07:00
parent 526cc9e3e8
commit 37418ced55
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,9 @@ def list_item_length(v):
if not isinstance(v, list):
raise Invalid('Not a list: {}'.format(type(v)))
for i in v:
if not isinstance(i, (str, unicode)):
raise Invalid('list item <{}> -> {} not one of (str, unicode)'
.format(i, type(i)))
if len(i) > MAX_ITEM_LENGTH:
raise Invalid('length {} > {}'.format(len(i), MAX_ITEM_LENGTH))