srkukarni commented on a change in pull request #1956: Add function-package-url 
support in function cli add url support to function cli
URL: https://github.com/apache/incubator-pulsar/pull/1956#discussion_r196628854
 
 

 ##########
 File path: 
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java
 ##########
 @@ -392,30 +398,61 @@ void processArguments() throws Exception {
 
         protected void validateFunctionConfigs(FunctionConfig functionConfig) {
 
-            if (functionConfig.getJar() != null && functionConfig.getPy() != 
null) {
+            if (isNotBlank(functionConfig.getJar()) && 
isNotBlank(functionConfig.getPy())) {
                 throw new ParameterException("Either a Java jar or a Python 
file needs to"
                         + " be specified for the function. Cannot specify 
both.");
             }
 
-            if (functionConfig.getJar() == null && functionConfig.getPy() == 
null) {
+            if (isBlank(functionConfig.getJar()) && 
isBlank(functionConfig.getPy())) {
                 throw new ParameterException("Either a Java jar or a Python 
file needs to"
                         + " be specified for the function. Please specify 
one.");
             }
 
-            if (!fileExists(userCodeFile)) {
-                throw new ParameterException("File " + userCodeFile + " does 
not exist");
+            boolean isJarPathUrl = isNotBlank(functionConfig.getJar()) && 
Utils.isFunctionPackageUrlSupported(functionConfig.getJar());
+            String jarFilePath = null;
+            if (isJarPathUrl) {
+                if (functionConfig.getJar().startsWith(Utils.HTTP)) {
 
 Review comment:
   Might be better if there is a util function that does this

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to