Update validate task behavior method

*Updated validate_task method in glance behaviors to
include further validation of the status of the task
before verifying the message and verifying that the
input_ parameter is not none

Change-Id: I42a6bbee8160f5f6ec556b4a2c04d1e35ac348d6
This commit is contained in:
Luke Wollney 2015-09-15 13:04:28 -05:00
parent 0062307d8e
commit 40003718e7

View File

@ -621,7 +621,7 @@ class ImagesBehaviors(BaseBehavior):
if task.created_at is None:
errors.append(Messages.PROPERTY_MSG.format(
'created_at', 'not None', task.created_at))
if task.input_.import_from is None:
if task.input_ is not None and task.input_.import_from is None:
errors.append(Messages.PROPERTY_MSG.format(
'import_from', 'not None', task.input_.import_from))
if (task.result is not None and
@ -641,7 +641,7 @@ class ImagesBehaviors(BaseBehavior):
if task.owner is None:
errors.append(Messages.PROPERTY_MSG.format(
'owner', 'not None', task.owner))
if task.message != '':
if task.status == TaskStatus.SUCCESS and task.message != '':
errors.append(Messages.PROPERTY_MSG.format(
'message', 'Empty message', task.message))
if task.schema != '/v2/schemas/task':