diff --git a/convert2rhel/actions/system_checks/custom_repos_are_valid.py b/convert2rhel/actions/system_checks/custom_repos_are_valid.py index 3f4ae4657..c55108a0e 100644 --- a/convert2rhel/actions/system_checks/custom_repos_are_valid.py +++ b/convert2rhel/actions/system_checks/custom_repos_are_valid.py @@ -37,8 +37,8 @@ def run(self): super(CustomReposAreValid, self).run() logger.task("Prepare: Check if --enablerepo repositories are accessible") - if not tool_opts.no_rhsm: - logger.info("Did not perform the check of repositories due to the use of RHSM for the conversion.") + if not tool_opts.enablerepo: + logger.info("Skipping the check as there was no --enablerepo option detected in the command-line.") return output, ret_code = call_yum_cmd( diff --git a/convert2rhel/unit_tests/actions/system_checks/custom_repos_are_valid_test.py b/convert2rhel/unit_tests/actions/system_checks/custom_repos_are_valid_test.py index a752f4d2b..ed28311fe 100644 --- a/convert2rhel/unit_tests/actions/system_checks/custom_repos_are_valid_test.py +++ b/convert2rhel/unit_tests/actions/system_checks/custom_repos_are_valid_test.py @@ -34,7 +34,7 @@ def test_custom_repos_are_valid(custom_repos_are_valid_action, monkeypatch, capl "call_yum_cmd", unit_tests.CallYumCmdMocked(return_code=0, return_string="Abcdef"), ) - monkeypatch.setattr(custom_repos_are_valid.tool_opts, "no_rhsm", True) + monkeypatch.setattr(custom_repos_are_valid.tool_opts, "enablerepo", ["rhel-7-server-optional-rpms"]) custom_repos_are_valid_action.run() @@ -47,7 +47,7 @@ def test_custom_repos_are_invalid(custom_repos_are_valid_action, monkeypatch): "call_yum_cmd", unit_tests.CallYumCmdMocked(return_code=1, return_string="YUM/DNF failed"), ) - monkeypatch.setattr(custom_repos_are_valid.tool_opts, "no_rhsm", True) + monkeypatch.setattr(custom_repos_are_valid.tool_opts, "enablerepo", ["rhel-7-server-optional-rpms"]) custom_repos_are_valid_action.run() @@ -63,11 +63,11 @@ def test_custom_repos_are_invalid(custom_repos_are_valid_action, monkeypatch): def test_custom_repos_are_valid_skip(custom_repos_are_valid_action, monkeypatch, caplog): - monkeypatch.setattr(custom_repos_are_valid.tool_opts, "no_rhsm", False) + monkeypatch.setattr(custom_repos_are_valid.tool_opts, "enablerepo", []) custom_repos_are_valid_action.run() assert ( - "Did not perform the check of repositories due to the use of RHSM for the conversion." + "Skipping the check as there was no --enablerepo option detected in the command-line." in caplog.records[-1].message )