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

[WFCORE-6541] Patch high level command should be completely disabled … #5701

Merged
merged 2 commits into from
Oct 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @author [email protected]
*/
@CommandDefinition(name = "apply", description = "")
@CommandDefinition(name = "apply", description = "", activator = PatchCommand.PatchCommandActivator.class)
public class PatchApply extends PatchOverrideCommand {

// Argument comes first, aesh behavior.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ public CommandResult execute(CLICommandInvocation commandInvocation) throws Comm
}

/**
* Hides the high level patch commands on a standalone installation only.
* Activates the high level patch command only under Domain Mode context.
*
* Since the introduction of Prospero as the tool to patch, the "patch" command only makes sense in domain
* mode to patch legacy host controllers that do not use Prospero. For example, in mixed domains where you
* need to patch a remote secondary host using the Domain Controller. The remote legacy hosts could only understand
* the "patch" command. Only in such a case, we activate the "patch" command.
*/
public static class PatchCommandActivator extends AbstractCommandActivator {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @author [email protected]
*/
@CommandDefinition(name = "history", description = "")
@CommandDefinition(name = "history", description = "", activator = PatchCommand.PatchCommandActivator.class)
public class PatchHistory extends AbstractDistributionCommand {

@Option(name = "patch-stream", hasValue = true, required = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author [email protected]
*/
@CommandDefinition(name = "info", description = "")
@CommandDefinition(name = "info", description = "", activator = PatchCommand.PatchCommandActivator.class)
public class PatchInfo extends AbstractDistributionCommand {

public static class NoStreamsActivator extends AbstractRejectOptionActivator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* @author [email protected]
*/
@CommandDefinition(name = "inspect", description = "")
@CommandDefinition(name = "inspect", description = "", activator = PatchCommand.PatchCommandActivator.class)
public class PatchInspect implements Command<CLICommandInvocation> {

// Argument comes first, aesh behavior.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class PatchRollbackActivator extends AbstractCommandActivator {

@Override
public boolean isActivated(ParsedCommand command) {
if (!getCommandContext().isDomainMode()) return false;

try {
AbstractDistributionCommand cmd = (AbstractDistributionCommand) command.command();
return !getPatches(getCommandContext(), cmd, cmd.getPatchStream(), cmd.getHost()).isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
patch.description=\
Apply a patch to the server or rollback a patch that has been applied.\n\
\n\
This command is only available in a Domain Mode to patch legacy Host \
Controllers but is deactivated for standalone or disconnected sessions \
and replaced by the 'installer' command. See 'help installer' to get \
more information about how to patch your server.\n\
\n\
This command does not require a connection to the server. If it is connected, \
it will patch the server's installation. If it is not connected, it will patch \
the server installation the command line interface belongs to.\n\
Expand Down
141 changes: 0 additions & 141 deletions patching/src/test/java/org/jboss/as/patching/cli/CLIPatchInfoUtil.java

This file was deleted.

Loading