From 4d42e1062e8e6a26e1c25de84b3181c00ce8a7d9 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Mar 09 2012 21:54:25 +0000 Subject: make SCM URL validity check more verbose When a builder parses an SCM URL, the daemon module's _parse_url() does a sanity check that it has properly understood all the necessary elements of the URL string before returning them. When this check fails, a "Invalid URL" message is raised, but this error message does not provide information about what portion of the URL was missing. Break this sanity check into multiple statements, so that we present a more detailed error message to the user. --- diff --git a/koji/daemon.py b/koji/daemon.py index 356392b..4804240 100644 --- a/koji/daemon.py +++ b/koji/daemon.py @@ -237,8 +237,16 @@ class SCM(object): query = query[:-1] # check for validity: params should be empty, query may be empty, everything else should be populated - if params or not (scheme and netloc and path and fragment): - raise koji.GenericError, 'Unable to parse SCM URL: %s' % self.url + if params : + raise koji.GenericError, 'Unable to parse SCM URL: %s . Param element %s should be empty.' % (self.url,param) + if not scheme : + raise koji.GenericError, 'Unable to parse SCM URL: %s . Could not find the scheme element.' % self.url + if not netloc : + raise koji.GenericError, 'Unable to parse SCM URL: %s . Could not find the netloc element.' % self.url + if not path : + raise koji.GenericError, 'Unable to parse SCM URL: %s . Could not find the path element.' % self.url + if not fragment : + raise koji.GenericError, 'Unable to parse SCM URL: %s . Could not find the fragment element.' % self.url # return parsed values return (scheme, user, netloc, path, query, fragment)