Improve the returned Message for nsd-create

When creating nsd with non-existent vnfd in tosca template, we got
internal error. This patch will fix this and will return with
NotFound error.

Partially Implements: blueprint improve-return-message
Closes-Bug: #1710801

Change-Id: I7e9da552673088fe36e244d4658ad243e21a1fca
This commit is contained in:
dharmendra 2019-01-31 22:49:30 -08:00
parent e88a482576
commit be6ceb11f7
2 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,7 @@ class BadRequest(TackerException):
class NotFound(TackerException):
pass
message = _('%(resource)s %(name)s not Found')
class Conflict(TackerException):

View File

@ -341,6 +341,8 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
def get_vnfd(self, context, vnfd_id, fields=None):
vnfd_db = self._get_resource(context, VNFD, vnfd_id)
if not vnfd_db:
raise exceptions.NotFound(resource='VNFD', name=vnfd_id)
return self._make_vnfd_dict(vnfd_db)
def get_vnfds(self, context, filters, fields=None):