Skip to content

Commit

Permalink
Merge pull request #582 from yersan/issue-580-main
Browse files Browse the repository at this point in the history
[580] Add the --rm option to the SPI apply update and revert commands
  • Loading branch information
spyrkob authored Mar 5, 2024
2 parents 994cc09 + 367ed5b commit 26cb039
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public void generateApplyCommand() throws Exception {
expected.append(CliConstants.CANDIDATE_DIR).append(" \"").append(Path.of("foo").toAbsolutePath()).append("\"");
expected.append(" ");
expected.append(CliConstants.YES);
expected.append(" ");
expected.append(CliConstants.REMOVE);

final ProvisioningDefinition provisioningDefinition = defaultWfCoreDefinition()
.setChannelCoordinates(channelsFile.toString())
Expand Down Expand Up @@ -115,6 +117,8 @@ public void generateApplyCommandWithOsShell() throws Exception {
expected.append(CliConstants.CANDIDATE_DIR).append(" \"").append(Path.of("foo").toAbsolutePath()).append("\"");
expected.append(" ");
expected.append(CliConstants.YES);
expected.append(" ");
expected.append(CliConstants.REMOVE);

final ProvisioningDefinition provisioningDefinition = defaultWfCoreDefinition()
.setChannelCoordinates(channelsFile.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ public String getApplyUpdateCommand(Path installationPath, Path candidatePath) {
return CliConstants.Commands.UPDATE + " " + CliConstants.Commands.APPLY + " "
+ CliConstants.DIR + " " + escape(installationPath.toAbsolutePath()) + " "
+ CliConstants.CANDIDATE_DIR + " " + escape(candidatePath.toAbsolutePath()) + " "
+ CliConstants.YES;
+ CliConstants.YES + " "
+ CliConstants.REMOVE;
}

@Override
public String getApplyRevertCommand(Path installationPath, Path candidatePath) {
return CliConstants.Commands.REVERT + " " + CliConstants.Commands.APPLY + " "
+ CliConstants.DIR + " " + escape(installationPath.toAbsolutePath()) + " "
+ CliConstants.CANDIDATE_DIR + " " + escape(candidatePath.toAbsolutePath()) + " "
+ CliConstants.YES;
+ CliConstants.YES + " "
+ CliConstants.REMOVE;
}

private String escape(Path absolutePath) {
Expand Down

0 comments on commit 26cb039

Please sign in to comment.