Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sadanand Shenoy committed Dec 11, 2023
1 parent 0ee64ba commit a895195
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

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;
Expand All @@ -27,6 +28,7 @@

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

Expand All @@ -43,6 +45,9 @@ 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;

Expand All @@ -52,7 +57,14 @@ public void execute(ScmClient scmClient) throws IOException {
try {
scmClient.closeContainer(containerId);
} catch (IOException ioe) {
LOG.error("Unable to close container", 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);
}
}
}

Expand Down

0 comments on commit a895195

Please sign in to comment.