diff options
author | Matthew Treinish <mtreinish@kortar.org> | 2015-02-25 09:35:49 -0500 |
---|---|---|
committer | Matthew Treinish <mtreinish@kortar.org> | 2015-03-03 20:02:12 -0500 |
commit | 4c4d34b2b0d70e0c92f568a0080eff0df49f096f (patch) | |
tree | 37f06bbc51f7ca88bbefc9f0200de3be455ab6af | |
parent | aa74d0fe68ac96db5f4b2779df6804bf97004195 (diff) | |
download | tempest-lib-4c4d34b2b0d70e0c92f568a0080eff0df49f096f.tar.gz |
Handle missing launchpadlib gracefully
The use of launchpadlib should not be required for tempest-lib, however
because we wanted to expose the skip_tracker as an entry point and
package it with the library an import to launchpadlib was needed in the
packaged source, which normally should require an entry in the
requirements file. This commit addresses that by making the
launchpadlib use not mandatory. The script will check if launchpadlib
is available and if it isn't the skip tracker will just exit after it
scans for the bug list.
Change-Id: I59814346e899e366734caaf757eb2d8fe5ecbcf7
-rwxr-xr-x | tempest_lib/cmd/skip_tracker.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tempest_lib/cmd/skip_tracker.py b/tempest_lib/cmd/skip_tracker.py index b823a1e..b5c9b95 100755 --- a/tempest_lib/cmd/skip_tracker.py +++ b/tempest_lib/cmd/skip_tracker.py @@ -25,7 +25,10 @@ import logging import os import re -from launchpadlib import launchpad +try: + from launchpadlib import launchpad +except ImportError: + launchpad = None LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache') @@ -114,9 +117,14 @@ def main(): duplicates = [] info("Total bug skips found: %d", len(results)) info("Total unique bugs causing skips: %d", len(unique_bugs)) - lp = launchpad.Launchpad.login_anonymously('grabbing bugs', - 'production', - LPCACHEDIR) + if launchpad is not None: + lp = launchpad.Launchpad.login_anonymously('grabbing bugs', + 'production', + LPCACHEDIR) + else: + print("To check the bug status launchpadlib should be installed") + exit(1) + for bug_no in unique_bugs: bug = lp.bugs[bug_no] duplicate = bug.duplicate_of_link |