From 773b134b786667bb6af6988f04b6abeaa0cb3670 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 5 Jul 2018 13:03:33 -0400 Subject: [PATCH] improve the error messages in the requirements check job The phrasing and formatting of the existing messages makes it hard for users unfamiliar with the requirements management process to understand what is wrong. This change tries to make the messages clearer, removes an overly verbose error message, and adds a message to handle the case where something is missing from the global list entirely. Change-Id: I40711bf53aac52d534a427f4bdd1a91c20106118 Signed-off-by: Doug Hellmann --- openstack_requirements/check.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/openstack_requirements/check.py b/openstack_requirements/check.py index 60d7ada464..9522ce731d 100644 --- a/openstack_requirements/check.py +++ b/openstack_requirements/check.py @@ -105,14 +105,24 @@ def _is_requirement_in_global_reqs(req, global_reqs): if req_exclusions.issubset(global_exclusions): return True else: + difference = global_exclusions - req_exclusions print( "Requirement for package {} " - "has an exclusion not found in the " - "global list: {} vs. {}".format( - req.package, req_exclusions, global_exclusions) + "excludes a version not excluded in the " + "global list.\n" + " Local settings : {}\n" + " Global settings: {}\n" + " Unexpected : {}".format( + req.package, req_exclusions, global_exclusions, + difference) ) return False + print( + "Could not find a global requirements entry to match package {}. " + "If the package is already included in the global list, " + "the name or platform markers there may not match the local settings." + ) return False @@ -151,9 +161,6 @@ def _validate_one(name, reqs, blacklist, global_reqs): counts[''] = counts.get('', 0) + 1 if not _is_requirement_in_global_reqs( req, global_reqs[name]): - print("Requirement for package %s: %s does " - "not match openstack/requirements value : %s" % ( - name, str(req), str(global_reqs[name]))) return True # check for minimum being defined min = [s for s in req.specifiers.split(',') if '>' in s]