From ba7b56a4518c26153b7f68fc200fb9ddeb70fcf2 Mon Sep 17 00:00:00 2001 From: James Guistwite Date: Tue, 16 Apr 2019 13:31:11 -0400 Subject: Set the reply success status from the result of the command Issue-ID: CLI-155 Change-Id: I5baa339cd5f4e26f607eab9f18f151ad06869c0e Signed-off-by: James Guistwite --- .../main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'grpc/grpc-server/src') diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java index 0c2f00b5..79d761d6 100644 --- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java +++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java @@ -211,12 +211,14 @@ public class OpenInterfaceGrpcServer { if (!cmd.isRpc()) { String printOut = cmd.getResult().print(); Builder reply = Output.newBuilder(); - reply.setSuccess(true); reply.putAttrs(OnapCommandConstants.ERROR, "{}"); if (executionStoreContext != null) reply.putAddons("execution-id", executionStoreContext.getExecutionId()); + // use the status from the plugin. + reply.setSuccess(cmd.getResult().isPassed()); + try { reply.putAttrs(OnapCommandConstants.RESULTS, new ObjectMapper().readTree(printOut).toString()); } catch (IOException e) { -- cgit 1.2.3-korg