Rework karaf CLI commands to print results on console 35/98635/2
authorDominik Vrbovsky <dominik.vrbovsky@pantheon.tech>
Mon, 22 Nov 2021 10:56:26 +0000 (11:56 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 10 Jan 2022 16:02:57 +0000 (16:02 +0000)
Some of these karaf CLI commands may produce return values and some CSIT components need to
read them from console.

Change-Id: Iae54c9481515c1e8fc42e9b1cf7b1530d523a142
Signed-off-by: Dominik Vrbovsky <dominik.vrbovsky@pantheon.tech>
opendaylight/md-sal/sal-cluster-admin-karaf-cli/src/main/java/org/opendaylight/controller/cluster/datastore/admin/command/AbstractRpcAction.java
opendaylight/md-sal/samples/clustering-test-app/karaf-cli/src/main/java/org/opendaylight/clustering/it/karaf/cli/AbstractRpcAction.java

index 0a85b56..f16ac25 100644 (file)
@@ -25,8 +25,10 @@ public abstract class AbstractRpcAction implements Action {
         if (!result.isSuccessful()) {
             // FIXME: is there a better way to report errors?
             System.out.println("Invocation failed: " + result.getErrors());
         if (!result.isSuccessful()) {
             // FIXME: is there a better way to report errors?
             System.out.println("Invocation failed: " + result.getErrors());
+            return null;
+        } else {
+            return result.getResult();
         }
         }
-        return null;
     }
 
     protected abstract ListenableFuture<? extends RpcResult<?>> invokeRpc();
     }
 
     protected abstract ListenableFuture<? extends RpcResult<?>> invokeRpc();
index d76dbb5..eb483bf 100644 (file)
@@ -23,8 +23,10 @@ public abstract class AbstractRpcAction implements Action {
         if (!result.isSuccessful()) {
             // FIXME: is there a better way to report errors?
             System.out.println("Invocation failed: " + result.getErrors());
         if (!result.isSuccessful()) {
             // FIXME: is there a better way to report errors?
             System.out.println("Invocation failed: " + result.getErrors());
+            return null;
+        } else {
+            return result.getResult();
         }
         }
-        return null;
     }
 
     protected abstract ListenableFuture<? extends RpcResult<?>> invokeRpc();
     }
 
     protected abstract ListenableFuture<? extends RpcResult<?>> invokeRpc();