Skip to content

Commit

Permalink
Remove custom handling for verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
tejaskriya committed Dec 18, 2023
1 parent 6aa87d7 commit 7b052fd
Showing 1 changed file with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@

import java.io.IOException;

import org.apache.hadoop.hdds.cli.GenericParentCommand;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
import org.apache.hadoop.hdds.scm.client.ScmClient;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;

Expand All @@ -40,29 +36,12 @@
versionProvider = HddsVersionProvider.class)
public class CloseSubcommand extends ScmSubcommand {

private static final Logger LOG =
LoggerFactory.getLogger(CloseSubcommand.class);

@CommandLine.Spec
private CommandLine.Model.CommandSpec spec;

@Parameters(description = "Id of the container to close")
private long containerId;

@Override
public void execute(ScmClient scmClient) throws IOException {
try {
scmClient.closeContainer(containerId);
} catch (IOException ioe) {
boolean verbose = spec != null && spec.root()
.userObject() instanceof GenericParentCommand &&
((GenericParentCommand) spec.root().userObject()).isVerbose();
if (!verbose) {
LOG.error("Unable to close container : {}", ioe.getMessage());
} else {
LOG.error("Unable to close container", ioe);
}
}
scmClient.closeContainer(containerId);
}

}

0 comments on commit 7b052fd

Please sign in to comment.