Skip to content

Commit

Permalink
Merge pull request wildfly#5701 from yersan/WFCORE-6541
Browse files Browse the repository at this point in the history
[WFCORE-6541] Patch high level command should be completely disabled …
  • Loading branch information
yersan authored Oct 12, 2023
2 parents a66a84f + 04baf62 commit eb66796
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 1,300 deletions.
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

0 comments on commit eb66796

Please sign in to comment.