plugin/hub: raise ParameterError for invalid input
Convert the jsonschema.exceptions.ValidationError into the more appropriate koji.ParameterError.
This commit is contained in:
parent
51f55998da
commit
5ba7028340
1 changed files with 4 additions and 1 deletions
|
|
@ -72,7 +72,10 @@ def osbuildImage(name, version, distro, image_types, target, arches, opts=None,
|
||||||
args = [name, version, distro, image_types, target, arches, opts]
|
args = [name, version, distro, image_types, target, arches, opts]
|
||||||
task = {"channel": "image"}
|
task = {"channel": "image"}
|
||||||
|
|
||||||
jsonschema.validate(args, OSBUILD_IMAGE_SCHMEA)
|
try:
|
||||||
|
jsonschema.validate(args, OSBUILD_IMAGE_SCHMEA)
|
||||||
|
except jsonschema.exceptions.ValidationError as err:
|
||||||
|
raise koji.ParameterError(str(err)) from None
|
||||||
|
|
||||||
if priority and priority < 0 and not context.session.hasPerm('admin'):
|
if priority and priority < 0 and not context.session.hasPerm('admin'):
|
||||||
raise koji.ActionNotAllowed('only admins may create high-priority tasks')
|
raise koji.ActionNotAllowed('only admins may create high-priority tasks')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue