Return an error if /modules/info doesn't return anything.

Unfortunately, this isn't very useful if /modules/info is provided with
multiple modules.  yum doesn't traceback when doPackageLists is given
something that doesn't exist.  It just returns an empty list.  If
/modules/info is given just one module and yum gives us an empty list,
it's easy to say what happened.  If /modules/info is given several
modules and just one does not exist, we will not be able to detect that.

Fixing this would require doing more yum operations, which is likely to
slow things down and isn't the direction I want to be going.

(cherry picked from commit 8e948e4a4d)
This commit is contained in:
Chris Lumens 2018-08-03 11:22:30 -04:00 committed by Brian C. Lane
parent 3e3598cd95
commit 191897d40e

View File

@ -1564,6 +1564,11 @@ def v0_api(api):
log.error("(v0_modules_info) %s", str(e))
return jsonify(status=False, errors=[str(e)]), 400
if not modules:
msg = "one of the requested modules does not exist: %s" % module_names
log.error("(v0_modules_info) %s" % msg)
return jsonify(status=False, errors=[msg]), 400
return jsonify(modules=modules)
@api.route("/api/v0/compose", methods=["POST"])