Skip to content

Commit

Permalink
Fix couple of issues from last #1299 (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d authored Aug 19, 2024
1 parent fc33f55 commit f94ddd5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RHSMCustomFactsConfig(actions.Action):

def run(self):
super(RHSMCustomFactsConfig, self).run()

loggerinst.task("Final: Update RHSM custom facts")
ret_code, output = subscription.update_rhsm_custom_facts()

if not output:
Expand Down
14 changes: 0 additions & 14 deletions convert2rhel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ def main_locked():
process_phase = ConversionPhase.POST_PONR_CHANGES
post_conversion_results = actions.run_post_actions()

# TODO(r0x0d): Remove this after migrating all functions to Actions.
post_ponr_changes()

_raise_for_skipped_failures(post_conversion_results)
report.post_conversion_report(
results=post_conversion_results,
Expand Down Expand Up @@ -365,17 +362,6 @@ def prepare_system():
pkgmanager.clean_yum_metadata()


#
# Running the conversion
#


def post_ponr_changes():
"""Start the conversion itself"""
loggerinst.task("Final: Update RHSM custom facts")
subscription.update_rhsm_custom_facts()


#
# Cleanup and exit
#
Expand Down
10 changes: 3 additions & 7 deletions convert2rhel/unit_tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def test_main(monkeypatch, tmp_path):
clear_versionlock_mock = mock.Mock()
ask_to_continue_mock = mock.Mock()
restart_system_mock = mock.Mock()
update_rhsm_custom_facts_mock = mock.Mock()
summary_as_json_mock = mock.Mock()
summary_as_txt_mock = mock.Mock()

Expand All @@ -263,7 +262,6 @@ def test_main(monkeypatch, tmp_path):
monkeypatch.setattr(report, "_summary", report_summary_mock)
monkeypatch.setattr(utils, "ask_to_continue", ask_to_continue_mock)
monkeypatch.setattr(utils, "restart_system", restart_system_mock)
monkeypatch.setattr(subscription, "update_rhsm_custom_facts", update_rhsm_custom_facts_mock)
monkeypatch.setattr(report, "summary_as_json", summary_as_json_mock)
monkeypatch.setattr(report, "summary_as_txt", summary_as_txt_mock)

Expand All @@ -283,7 +281,6 @@ def test_main(monkeypatch, tmp_path):
assert clear_versionlock_mock.call_count == 1
assert ask_to_continue_mock.call_count == 1
assert restart_system_mock.call_count == 1
assert update_rhsm_custom_facts_mock.call_count == 1
assert summary_as_json_mock.call_count == 1
assert summary_as_txt_mock.call_count == 1

Expand Down Expand Up @@ -610,14 +607,14 @@ def test_main_rollback_post_ponr_changes_phase(self, monkeypatch, caplog, tmp_pa
collect_early_data_mock = mock.Mock()
clean_yum_metadata_mock = mock.Mock()
run_pre_actions_mock = mock.Mock()
run_post_actions_mock = mock.Mock()
post_ponr_changes_mock = mock.Mock(side_effect=Exception)
run_post_actions_mock = mock.Mock(side_effect=Exception)
find_actions_of_severity_mock = mock.Mock(return_value=[])
report_summary_mock = mock.Mock()
clear_versionlock_mock = mock.Mock()
ask_to_continue_mock = mock.Mock()
summary_as_json_mock = mock.Mock()
summary_as_txt_mock = mock.Mock()
pick_conversion_results_mock = mock.Mock(return_value=["test"])

# Mock the rollback calls
finish_collection_mock = mock.Mock()
Expand All @@ -639,11 +636,11 @@ def test_main_rollback_post_ponr_changes_phase(self, monkeypatch, caplog, tmp_pa
monkeypatch.setattr(actions, "find_actions_of_severity", find_actions_of_severity_mock)
monkeypatch.setattr(report, "_summary", report_summary_mock)
monkeypatch.setattr(utils, "ask_to_continue", ask_to_continue_mock)
monkeypatch.setattr(main, "post_ponr_changes", post_ponr_changes_mock)
monkeypatch.setattr(breadcrumbs, "finish_collection", finish_collection_mock)
monkeypatch.setattr(subscription, "update_rhsm_custom_facts", update_rhsm_custom_facts_mock)
monkeypatch.setattr(report, "summary_as_json", summary_as_json_mock)
monkeypatch.setattr(report, "summary_as_txt", summary_as_txt_mock)
monkeypatch.setattr(main, "_pick_conversion_results", pick_conversion_results_mock)

assert main.main() == 1
assert require_root_mock.call_count == 1
Expand All @@ -655,7 +652,6 @@ def test_main_rollback_post_ponr_changes_phase(self, monkeypatch, caplog, tmp_pa
assert collect_early_data_mock.call_count == 1
assert clean_yum_metadata_mock.call_count == 1
assert run_pre_actions_mock.call_count == 1
assert run_pre_actions_mock.call_count == 1
assert find_actions_of_severity_mock.call_count == 1
assert clear_versionlock_mock.call_count == 1
assert report_summary_mock.call_count == 2
Expand Down

0 comments on commit f94ddd5

Please sign in to comment.