[jboss-jira] [JBoss JIRA] (WFCORE-2330) JBoss-CLI "deploy -l" always returns exit code 1 even when it succeeds
Masafumi Miura (JIRA)
issues at jboss.org
Sun Feb 26 20:46:00 EST 2017
[ https://issues.jboss.org/browse/WFCORE-2330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Masafumi Miura updated WFCORE-2330:
-----------------------------------
Git Pull Request: https://github.com/wildfly/wildfly-core/pull/2207
> JBoss-CLI "deploy -l" always returns exit code 1 even when it succeeds
> ----------------------------------------------------------------------
>
> Key: WFCORE-2330
> URL: https://issues.jboss.org/browse/WFCORE-2330
> Project: WildFly Core
> Issue Type: Bug
> Components: CLI
> Reporter: Masafumi Miura
>
> JBoss-CLI "deploy -l" always returns exit code 1 even when it succeededs.
> It looks that DeploymentHandler.listDeployments() always throws CommandFormatException and this causes the "deploy -l" command returns exit code 1.
> {code:java|title=cli/src/main/java/org/jboss/as/cli/handlers/DeploymentHandler.java}
> 55 protected void listDeployments(CommandContext ctx, boolean l) throws CommandFormatException {
> 56 if(!l) {
> 57 printList(ctx, Util.getDeployments(ctx.getModelControllerClient()), l);
> 58 return;
> 59 }
> 60 final ModelControllerClient client = ctx.getModelControllerClient();
> 61 final List<String> names = Util.getDeployments(client);
> 62 if(names.isEmpty()) {
> 63 return;
> 64 }
> 65
> 66 final StrictSizeTable table = new StrictSizeTable(names.size());
> 67 final List<Property> descriptions = getDeploymentDescriptions(ctx, names).asPropertyList();
> 68 for(Property prop : descriptions) {
> 69 final ModelNode step = prop.getValue();
> 70 if(step.hasDefined(Util.RESULT)) {
> 71 final ModelNode result = step.get(Util.RESULT);
> 72 table.addCell(Util.NAME, result.get(Util.NAME).asString());
> 73 table.addCell(Util.RUNTIME_NAME, result.get(Util.RUNTIME_NAME).asString());
> 74 if(result.has(Util.ENABLED)) {
> 75 table.addCell(Util.ENABLED, result.get(Util.ENABLED).asString());
> 76 }
> 77 if(result.has(Util.STATUS)) {
> 78 table.addCell(Util.STATUS, result.get(Util.STATUS).asString());
> 79 }
> 80 }
> 81 if(!table.isAtLastRow()) {
> 82 table.nextRow();
> 83 }
> 84 }
> 85 throw new CommandFormatException(table.toString()); // -> CommandFormatException is always thrown. This looks a root cause.
> 86 }
> {code}
> {code:java|title=cli/src/main/java/org/jboss/as/cli/impl/CommandContextImpl.java}
> 907 public void handleSafe(String line) {
> 908 exitCode = 0;
> 909 try {
> 910 handle(line);
> 911 } catch(Throwable t) {
> 912 error(Util.getMessagesFromThrowable(t)); // -> This is invoked when CommandFormatException happened in the above listDeployments.
> 913 }
> 914 }
> :
> 993 protected void error(String message) {
> 994 this.exitCode = 1;
> 995 printLine(message);
> 996 }
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list