Skip to content

Commit

Permalink
Remove bugzilla from sweep commands
Browse files Browse the repository at this point in the history
  • Loading branch information
thegreyd committed Aug 3, 2023
1 parent b30a554 commit 7f43a0b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
11 changes: 1 addition & 10 deletions elliottlib/cli/find_bugs_qe_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@ def find_bugs_qe_cli(runtime: Runtime, noop):
"""
runtime.initialize()
find_bugs_obj = FindBugsQE()
exit_code = 0
for b in [runtime.bug_trackers('jira'), runtime.bug_trackers('bugzilla')]:
try:
find_bugs_qe(runtime, find_bugs_obj, noop, b)
except Exception as e:
LOGGER.error(traceback.format_exc())
LOGGER.error(f'exception with {b.type} bug tracker: {e}')
exit_code = 1
sys.exit(exit_code)
find_bugs_qe(runtime, FindBugsQE(), noop, runtime.bug_trackers('jira'))


def find_bugs_qe(runtime, find_bugs_obj, noop, bug_tracker):
Expand Down
15 changes: 2 additions & 13 deletions elliottlib/cli/find_bugs_sweep_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,8 @@ async def find_bugs_sweep_cli(runtime: Runtime, advisory_id, default_advisory_ty
find_bugs_obj.include_status(include_status)
find_bugs_obj.exclude_status(exclude_status)

bugs: type_bug_list = []
errors = []
for b in [runtime.bug_trackers('jira'), runtime.bug_trackers('bugzilla')]:
try:
bugs.extend(await find_and_attach_bugs(runtime, advisory_id, default_advisory_type, major_version, find_bugs_obj,
output, brew_event, noop, count_advisory_attach_flags, b))
except Exception as e:
errors.append(e)
logger.error(traceback.format_exc())
logger.error(f'exception with {b.type} bug tracker: {e}')

if errors:
raise ElliottFatalError(f"Error finding or attaching bugs: {errors}. See logs for more information.")
bugs = await find_and_attach_bugs(runtime, advisory_id, default_advisory_type, major_version, find_bugs_obj,
output, brew_event, noop, count_advisory_attach_flags, runtime.bug_trackers('jira'))

if not bugs:
logger.info('No bugs found')
Expand Down
10 changes: 1 addition & 9 deletions tests/test_find_bugs_sweep_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ def test_find_bugs_sweep_advisory_type(self, bugzilla_filter_mock, jira_filter_m
self.fail(t)

@patch('elliottlib.bzutil.JIRABugTracker.filter_attached_bugs')
@patch('elliottlib.bzutil.BugzillaBugTracker.filter_attached_bugs')
def test_find_bugs_sweep_default_advisories(self, bugzilla_filter_mock, jira_filter_mock):
def test_find_bugs_sweep_default_advisories(self, jira_filter_mock):
runner = CliRunner()
image_bugs = [flexmock(id=1), flexmock(id=2)]
rpm_bugs = [flexmock(id=3), flexmock(id=4)]
Expand All @@ -237,13 +236,6 @@ def test_find_bugs_sweep_default_advisories(self, bugzilla_filter_mock, jira_fil
flexmock(Runtime).should_receive("get_default_advisories").and_return({'image': 123, 'rpm': 123, 'extras': 123,
'metadata': 123})

# bz mocks
flexmock(BugzillaBugTracker).should_receive("get_config").and_return({'target_release': ['4.6.z']})
flexmock(BugzillaBugTracker).should_receive("login")
flexmock(BugzillaBugTracker).should_receive("search").and_return(image_bugs + rpm_bugs + extras_bugs)
flexmock(BugzillaBugTracker).should_receive("attach_bugs").times(3).and_return()
bugzilla_filter_mock.return_value = []

# jira mocks
flexmock(JIRABugTracker).should_receive("get_config").and_return({'target_release': ['4.6.z']})
flexmock(JIRABugTracker).should_receive("login")
Expand Down

0 comments on commit 7f43a0b

Please sign in to comment.