Fix the error reporting.

- Don't return a dict error
- in manager return full response
- return the result in Resource.validate()

Change-Id: I585ea9dd9cf747927fb4effb90cfff49cba20931
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2012-06-15 09:49:46 +10:00
parent 1fc9ff4a0b
commit f45d436263
4 changed files with 6 additions and 8 deletions

View File

@ -154,11 +154,9 @@ class Properties(CheckedDict):
if 'Required' in self.data[key]:
if self.data[key]['Required'] \
and not 'Value' in self.data[key]:
return {'Error':
'%s Property must be provided' % key}
return '%s Property must be provided' % key
# are there unimplemented Properties
if not self.data[key]['Implemented'] and 'Value' in self.data[key]:
return {'Error':
'%s Property not implemented yet' % key}
return '%s Property not implemented yet' % key
return None

View File

@ -203,7 +203,7 @@ class EngineManager(manager.Manager):
template_copy = None
if 'Malformed Query Response' in \
response['ValidateTemplateResult']['Description']:
return response['ValidateTemplateResult']['Description']
return response
stack = parser.Stack(context, stack_name, template, 0, params,
metadata_server=metadata_server)

View File

@ -103,7 +103,7 @@ class Stack(object):
res = str(ex)
finally:
if res:
err_str = 'Malformed Query Response [%s]' % (res)
err_str = 'Malformed Query Response %s' % (res)
response = {'ValidateTemplateResult': {
'Description': err_str,
'Parameters': []}}

View File

@ -128,8 +128,8 @@ class Resource(object):
try:
self.calculate_properties()
except ValueError as ex:
return {'Error': '%s' % str(ex)}
self.properties.validate()
return str(ex)
return self.properties.validate()
def instance_id_set(self, inst):
self.instance_id = inst