Fix: Tackerclient failed to handle yaml load error.

While onboarding a vnfd with infected vnfd file, yaml.load() raised exception.
Due to which instead of giving meaningful error message, tackerclient raised
traces with TypeError.
Fixing this issue with proper error handling.

Change-Id: I7a4150a898fcf99d8ffbc97e16da6a219cade93d
Closes-Bug: #1780214
This commit is contained in:
dharmendra 2018-07-05 08:53:39 +00:00
parent efb7704778
commit ed23c0e7bd

View File

@ -77,7 +77,8 @@ class CreateVNFD(command.ShowOne):
try:
vnfd = yaml.load(vnfd, Loader=yaml.SafeLoader)
except yaml.YAMLError as e:
raise exceptions.InvalidInput(e)
msg = _("yaml failed to load vnfd file. %s") % e
raise exceptions.InvalidInput(msg)
if not vnfd:
raise exceptions.InvalidInput("vnfd file is empty")
body[_VNFD]['attributes'] = {'vnfd': vnfd}