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

aboda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 27e34fb  MINIFICPP-1205 - do not show inline script option for 
ExecutePythonProcessor
27e34fb is described below

commit 27e34fbcf537a66e683711598d10b8edb844400a
Author: Adam Hunyadi <[email protected]>
AuthorDate: Thu Apr 23 12:13:54 2020 +0200

    MINIFICPP-1205 - do not show inline script option for ExecutePythonProcessor
    
    Clean up leftover related code artifacts
    
    Signed-off-by: Arpad Boda <[email protected]>
    
    This closes #768
---
 PROCESSORS.md                                       |  2 +-
 extensions/script/python/ExecutePythonProcessor.cpp | 17 ++++++-----------
 extensions/script/python/ExecutePythonProcessor.h   |  1 -
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/PROCESSORS.md b/PROCESSORS.md
index c7c4b2a..0e97162 100644
--- a/PROCESSORS.md
+++ b/PROCESSORS.md
@@ -241,7 +241,7 @@ In the list below, the names of required properties appear 
in bold. Any other pr
 | Name | Default Value | Allowable Values | Description | 
 | - | - | - | - | 
 |Module Directory|||Comma-separated list of paths to files and/or directories 
which contain modules required by the script|
-|Script File|||Path to script file to execute. Only one of Script File or 
Script Body may be used|
+|Script File|||Path to script file to execute|
 ### Relationships
 
 | Name | Description |
diff --git a/extensions/script/python/ExecutePythonProcessor.cpp 
b/extensions/script/python/ExecutePythonProcessor.cpp
index 66d8bf6..ae34ccc 100644
--- a/extensions/script/python/ExecutePythonProcessor.cpp
+++ b/extensions/script/python/ExecutePythonProcessor.cpp
@@ -35,8 +35,7 @@ namespace python {
 namespace processors {
 
 core::Property ExecutePythonProcessor::ScriptFile("Script File",  // NOLINT
-    R"(Path to script file to execute.
-                                            Only one of Script File or Script 
Body may be used)", "");
+    R"(Path to script file to execute)", "");
 core::Property ExecutePythonProcessor::ModuleDirectory("Module Directory",  // 
NOLINT
     R"(Comma-separated list of paths to files and/or directories which
                                                  contain modules required by 
the script)", "");
@@ -100,7 +99,7 @@ void ExecutePythonProcessor::onSchedule(const 
std::shared_ptr<core::ProcessConte
   context->getProperty(ScriptFile.getName(), script_file_);
   context->getProperty(ModuleDirectory.getName(), module_directory_);
   if (script_file_.empty() && script_engine_.empty()) {
-    logger_->log_error("Either Script Body or Script File must be defined");
+    logger_->log_error("Script File must be defined");
     return;
   }
 
@@ -120,12 +119,10 @@ void ExecutePythonProcessor::onSchedule(const 
std::shared_ptr<core::ProcessConte
         throw std::runtime_error("No script engine available");
       }
 
-      if (!script_body_.empty()) {
-        engine->eval(script_body_);
-      } else if (!script_file_.empty()) {
+      if (!script_file_.empty()) {
         engine->evalFile(script_file_);
       } else {
-        throw std::runtime_error("Neither Script Body nor Script File is 
available to execute");
+        throw std::runtime_error("No Script File is available to execute");
       }
     }
 
@@ -162,12 +159,10 @@ void ExecutePythonProcessor::onTrigger(const 
std::shared_ptr<core::ProcessContex
         throw std::runtime_error("No script engine available");
       }
 
-      if (!script_body_.empty()) {
-        engine->eval(script_body_);
-      } else if (!script_file_.empty()) {
+      if (!script_file_.empty()) {
         engine->evalFile(script_file_);
       } else {
-        throw std::runtime_error("Neither Script Body nor Script File is 
available to execute");
+        throw std::runtime_error("No Script File is available to execute");
       }
     }
 
diff --git a/extensions/script/python/ExecutePythonProcessor.h 
b/extensions/script/python/ExecutePythonProcessor.h
index 91151fa..a487554 100644
--- a/extensions/script/python/ExecutePythonProcessor.h
+++ b/extensions/script/python/ExecutePythonProcessor.h
@@ -101,7 +101,6 @@ class ExecutePythonProcessor : public core::Processor {
 
   std::string script_engine_;
   std::string script_file_;
-  std::string script_body_;
   std::string module_directory_;
 
   moodycamel::ConcurrentQueue<std::shared_ptr<script::ScriptEngine>> 
script_engine_q_;

Reply via email to