[rhel7-branch 1/7] Update makebumpver to include flags on first request

bcl installerbot-noreply at redhat.com
Thu May 28 23:36:16 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

python-bugzilla has been complaining that it needs to refresh the object
because it didn't get the flags the first time. This switches to using
.getbug instead of .query and adds the flags to the returned data for
each bug.

This also quiets down some logging from urllib3 that was making it hard
to read the results of the bugzilla checks.

(cherry picked from commit ce928e6f51a13aaf75701ba1bd01ec74b36f7500)
---
 scripts/makebumpver | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/scripts/makebumpver b/scripts/makebumpver
index bb1d6e6..57f549f 100755
--- a/scripts/makebumpver
+++ b/scripts/makebumpver
@@ -24,6 +24,8 @@ import logging
 logging.basicConfig(level=logging.DEBUG)
 log = logging.getLogger("bugzilla")
 log.setLevel(logging.INFO)
+urllib_log = logging.getLogger("urllib3")
+urllib_log.setLevel(logging.ERROR)
 
 import bugzilla
 import datetime
@@ -131,7 +133,7 @@ class MakeBumpVer:
 
         return ret
 
-    def _queryBug(self, bug):
+    def _queryBug(self, bugid):
         if not self.bz:
             sys.stdout.write("Connecting to %s...\n" % self.bzserver)
 
@@ -151,17 +153,17 @@ class MakeBumpVer:
             rc = self.bz.login(self.username, self.password)
             log.debug("login rc = %s", rc)
 
-        if bug in self._bz_cache:
-            return self._bz_cache[bug]
+        if bugid in self._bz_cache:
+            return self._bz_cache[bugid]
 
-        bugs = self.bz.query({'bug_id': bug})
-        log.debug("bugs = %s", bugs)
+        bug = self.bz.getbug(bugid, extra_fields="flags")
+        log.debug("bug = %s", bug)
 
-        if len(bugs) != 1:
+        if not bug:
             return None
         else:
-            self._bz_cache[bug] = bugs[0]
-            return bugs[0]
+            self._bz_cache[bugid] = bug
+            return bug
 
     def _isRHELBug(self, bug, commit, summary):
         bzentry = self._queryBug(bug)
@@ -488,6 +490,7 @@ def main(argv):
             skip_acks = True
         elif o in ('-d', '--debug'):
             log.setLevel(logging.DEBUG)
+            urllib_log.setLevel(logging.DEBUG)
         elif o in ('-?', '--help'):
             show_help = True
         else:


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/463d47acf8b1e3ee224eba5b3c2842f9cd9d6827


More information about the anaconda-patches mailing list