You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by go...@apache.org on 2019/10/23 16:15:39 UTC

[storm] branch 2.1.x-branch updated: STORM-3520: Fixes drpc-client function argument validation in Storm CLI

This is an automated email from the ASF dual-hosted git repository.

govind pushed a commit to branch 2.1.x-branch
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/2.1.x-branch by this push:
     new 164b15d  STORM-3520: Fixes drpc-client function argument validation in Storm CLI
164b15d is described below

commit 164b15dab5bae399b8d8064c9b283343a3070ac2
Author: Govind Menon <go...@gmail.com>
AuthorDate: Thu Oct 10 13:59:06 2019 -0500

    STORM-3520: Fixes drpc-client function argument validation in Storm CLI
---
 bin/storm.py                           |  4 ++--
 storm-client/test/py/test_storm_cli.py | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/bin/storm.py b/bin/storm.py
index 48b9cf3..16ddb95 100755
--- a/bin/storm.py
+++ b/bin/storm.py
@@ -1391,7 +1391,7 @@ def logviewer(args):
 
 
 def drpc_client(args):
-    if not args.function and not (len(args.function_arguments) % 2):
+    if not args.function and (len(args.function_arguments) % 2):
         raise argparse.ArgumentTypeError(
             "If no -f is supplied arguments need to be in the form [function arg]. " +
             "This has {} args".format(
@@ -1401,7 +1401,7 @@ def drpc_client(args):
 
     exec_storm_class(
         "org.apache.storm.command.BasicDrpcClient",
-        args=remove_common_options(sys.argv[2:]),
+        args=remove_common_options(sys.argv[2:]), storm_config_opts=args.storm_config_opts,
         jvmtype="-client",
         extrajars=[USER_CONF_DIR, STORM_BIN_DIR],
         overriding_conf_file=args.config)
diff --git a/storm-client/test/py/test_storm_cli.py b/storm-client/test/py/test_storm_cli.py
index d187fe5..bf5001c 100644
--- a/storm-client/test/py/test_storm_cli.py
+++ b/storm-client/test/py/test_storm_cli.py
@@ -385,6 +385,32 @@ class TestStormCli(TestCase):
             ])
         )
 
+    def test_drpc_client_command(self):
+        self.base_test([
+            'storm', 'drpc-client', 'exclaim', 'a', 'exclaim', 'b', 'test', 'bar'
+        ], self.mock_execvp, mock.call(
+            self.java_cmd, [
+                self.java_cmd, '-client', '-Ddaemon.name=', '-Dstorm.options=',
+                '-Dstorm.home=' + self.storm_dir + '', '-Dstorm.log.dir=' + self.storm_dir + "/logs",
+                '-Djava.library.path=', '-Dstorm.conf.file=', '-cp',
+                '' + self.storm_dir + '/*:' + self.storm_dir + '/lib:' + self.storm_dir + '/extlib:' + self.storm_dir +
+                '/extlib-daemon:' + self.storm_dir + '/conf:' + self.storm_dir +
+                '/bin', 'org.apache.storm.command.BasicDrpcClient', 'exclaim', 'a', 'exclaim', 'b', 'test', 'bar'
+            ])
+        )
+        self.base_test([
+            'storm', 'drpc-client', '-f', 'exclaim', 'a', 'b'
+        ], self.mock_execvp, mock.call(
+            self.java_cmd, [
+                self.java_cmd, '-client', '-Ddaemon.name=', '-Dstorm.options=',
+                '-Dstorm.home=' + self.storm_dir + '', '-Dstorm.log.dir=' + self.storm_dir + "/logs",
+                '-Djava.library.path=', '-Dstorm.conf.file=', '-cp',
+                '' + self.storm_dir + '/*:' + self.storm_dir + '/lib:' + self.storm_dir + '/extlib:' + self.storm_dir +
+                '/extlib-daemon:' + self.storm_dir + '/conf:' + self.storm_dir +
+                '/bin', 'org.apache.storm.command.BasicDrpcClient', '-f', 'exclaim', 'a', 'b'
+            ])
+        )
+
     def test_healthcheck_command(self):
         self.base_test([
             'storm', 'node-health-check'