summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/parameters.py
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2016-07-08 15:15:00 +0800
committershangxdy <shang.xiaodong@zte.com.cn>2016-07-10 00:38:59 +0800
commit0997552722dc4845a854e0e6f8d7f18058e26380 (patch)
treeb90d1e808bb326612211ba56b3b941516493398d /tosca2heat/tosca-parser/toscaparser/parameters.py
parent7fe3011a67a239f7dc04153c54eaff78ef967eaf (diff)
Synchronise the openstack bugs
When run unittests through tox, some test cases are always error, the errors are already done in openstack community, so it's necessary to synchronise the fixes. Change-Id: Ib29078e6cc138a474e89c6a2cc90ad7a1db1bb46 JIRA: PARSER-63 Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/parameters.py')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/parameters.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/parameters.py b/tosca2heat/tosca-parser/toscaparser/parameters.py
index 983aee3..1d2cb29 100644
--- a/tosca2heat/tosca-parser/toscaparser/parameters.py
+++ b/tosca2heat/tosca-parser/toscaparser/parameters.py
@@ -27,8 +27,9 @@ log = logging.getLogger('tosca')
class Input(object):
- INPUTFIELD = (TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS) = \
- ('type', 'description', 'default', 'constraints')
+ INPUTFIELD = (TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS, REQUIRED,
+ STATUS) = ('type', 'description', 'default',
+ 'constraints', 'required', 'status')
def __init__(self, name, schema_dict):
self.name = name
@@ -53,7 +54,7 @@ class Input(object):
def validate(self, value=None):
self._validate_field()
self.validate_type(self.type)
- if value:
+ if value is not None:
self._validate_value(value)
def _validate_field(self):
@@ -68,13 +69,16 @@ class Input(object):
ExceptionCollector.appendException(
ValueError(_('Invalid type "%s".') % type))
+ # TODO(anyone) Need to test for any built-in datatype not just network
+ # that is, tosca.datatypes.* and not assume tosca.datatypes.network.*
+ # TODO(anyone) Add support for tosca.datatypes.Credential
def _validate_value(self, value):
tosca = EntityType.TOSCA_DEF
datatype = None
if self.type in tosca:
datatype = tosca[self.type]
- elif EntityType.DATATYPE_PREFIX + self.type in tosca:
- datatype = tosca[EntityType.DATATYPE_PREFIX + self.type]
+ elif EntityType.DATATYPE_NETWORK_PREFIX + self.type in tosca:
+ datatype = tosca[EntityType.DATATYPE_NETWORK_PREFIX + self.type]
DataEntity.validate_datatype(self.type, value, None, datatype)