Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHELC-1425, RHELC-1429] Remove -v|--variant arg #1149

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions convert2rhel/toolopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,6 @@ def _add_subscription_manager_options(self):
" 'subscription-manager list --available'."
" If no pool ID is provided, the --auto option is used",
)
group.add_argument(
"-v",
"--variant",
help="This option is not supported anymore and has no effect. When"
" converting a system to RHEL 7 using subscription-manager,"
" the system is now always converted to the Server variant. In case"
" of using custom repositories, the system is converted to the variant"
" provided by these repositories.",
)
group.add_argument(
"--serverurl",
help="Hostname of the subscription service to be used when registering the system with"
Expand All @@ -332,8 +323,6 @@ def _process_cli_options(self):
"""Process command line options used with the tool."""
_log_command_used()

warn_on_unsupported_options()

# algorithm function to properly organize all CLI args
argv = _add_default_command(sys.argv[1:])
parsed_opts = self._parser.parse_args(argv)
Expand Down Expand Up @@ -512,15 +501,6 @@ def _process_cli_options(self):
)


def warn_on_unsupported_options():
if any(x in sys.argv[1:] for x in ["--variant", "-v"]):
loggerinst.warning(
"The -v|--variant option is not supported anymore and has no effect.\n"
"See help (convert2rhel -h) for more information."
)
utils.ask_to_continue()


def _log_command_used():
"""We want to log the command used for convert2rhel to make it easier to know what command was used
when debugging the log files. Since we can't differentiate between the handlers we log to both stdout
Expand Down
25 changes: 0 additions & 25 deletions convert2rhel/unit_tests/toolopts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,31 +139,6 @@ def test_serverurl_with_no_rhsm_credentials(self, caplog, monkeypatch, global_to
assert message in caplog.text


@pytest.mark.parametrize(
("argv", "warn", "ask_to_continue"),
(
(mock_cli_arguments(["-v", "Server"]), True, True),
(mock_cli_arguments(["--variant", "Client"]), True, True),
(mock_cli_arguments(["-v"]), True, True),
(mock_cli_arguments(["--variant"]), True, True),
(mock_cli_arguments(["--version"]), False, False),
(mock_cli_arguments([]), False, False),
),
)
def test_cmdline_obsolete_variant_option(argv, warn, ask_to_continue, monkeypatch, caplog):
monkeypatch.setattr(sys, "argv", argv)
monkeypatch.setattr(convert2rhel.utils, "ask_to_continue", mock.Mock())
convert2rhel.toolopts.warn_on_unsupported_options()
if warn:
assert "variant option is not supported" in caplog.text
else:
assert "variant option is not supported" not in caplog.text
if ask_to_continue:
convert2rhel.utils.ask_to_continue.assert_called_once()
else:
convert2rhel.utils.ask_to_continue.assert_not_called()


@pytest.mark.parametrize(
("argv", "raise_exception", "no_rhsm_value"),
(
Expand Down
14 changes: 0 additions & 14 deletions man/convert2rhel.8
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,6 @@ Subscription pool ID. A list of the available subscriptions is possible to
obtain by running 'subscription\-manager list \-\-available'. If no pool ID is
provided, the \-\-auto option is used

.TP
\fB\-v\fR \fI\,VARIANT\/\fR, \fB\-\-variant\fR \fI\,VARIANT\/\fR
This option is not supported anymore and has no effect. When converting a
system to RHEL 7 using subscription\-manager, the system is now always
converted to the Server variant. In case of using custom repositories, the
system is converted to the variant provided by these repositories.

.TP
\fB\-\-serverurl\fR \fI\,SERVERURL\/\fR
Hostname of the subscription service to be used when registering the system
Expand Down Expand Up @@ -287,13 +280,6 @@ Subscription pool ID. A list of the available subscriptions is possible to
obtain by running 'subscription\-manager list \-\-available'. If no pool ID is
provided, the \-\-auto option is used

.TP
\fB\-v\fR \fI\,VARIANT\/\fR, \fB\-\-variant\fR \fI\,VARIANT\/\fR
This option is not supported anymore and has no effect. When converting a
system to RHEL 7 using subscription\-manager, the system is now always
converted to the Server variant. In case of using custom repositories, the
system is converted to the variant provided by these repositories.

.TP
\fB\-\-serverurl\fR \fI\,SERVERURL\/\fR
Hostname of the subscription service to be used when registering the system
Expand Down
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ markers =
test_version_older_with_envar
test_clean_cache
test_log_rhsm_error
test_variant_message
test_data_collection_acknowledgement
test_disable_data_collection
test_analyze_incomplete_rollback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ description: |
- Only last version of Convert2RHEL supported
- Yum cache cleaned before any other check
- Missing RHSM certificates logged properly
- Deprecated --variant message displayed

tier: 0

Expand Down Expand Up @@ -122,17 +121,6 @@ tag+:
pytest -svv -m test_log_rhsm_error


/variant_message:
summary+: |
Deprecated variant message
description+: |
Verify that the message about deprecated --variant option is printed.
tag+:
- variant-message
test: |
pytest -svv -m test_variant_message


/data_collection:
summary+: |
Data collection sanity test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,36 +239,6 @@ def test_rhsm_error_logged(convert2rhel):
assert "ERROR - OSError(2): No such file or directory" not in line


@pytest.mark.test_variant_message
def test_check_variant_message(convert2rhel):
"""
Run Convert2RHEL with deprecated -v/--variant option and verify that the warning message is shown.
"""
# Run c2r with --variant option
with convert2rhel("--debug --variant Server") as c2r:
c2r.expect("WARNING - The -v|--variant option is not supported anymore and has no effect")
c2r.sendcontrol("c")
assert c2r.exitstatus != 0

# Run c2r with --variant option empty
with convert2rhel("--debug --variant") as c2r:
c2r.expect("WARNING - The -v|--variant option is not supported anymore and has no effect")
c2r.sendcontrol("c")
assert c2r.exitstatus != 0

# Run c2r with -v option
with convert2rhel("--debug -v Client") as c2r:
c2r.expect("WARNING - The -v|--variant option is not supported anymore and has no effect")
c2r.sendcontrol("c")
assert c2r.exitstatus != 0

# Run c2r with -v option empty
with convert2rhel("--debug -v") as c2r:
c2r.expect("WARNING - The -v|--variant option is not supported anymore and has no effect")
c2r.sendcontrol("c")
assert c2r.exitstatus != 0


@pytest.mark.test_data_collection_acknowledgement
def test_data_collection_acknowledgement(shell, convert2rhel):
"""
Expand Down
Loading