lib/helper-run-class.rb in canzea-0.1.129 vs lib/helper-run-class.rb in canzea-0.1.130

- old
+ new

@@ -42,10 +42,16 @@ if File.exist?(envScript) @log.info("Adding environment variables...") envPush.addToEnv "#{envScript}" end + if File.exist?("#{@basePath}/helpers/#{solution}/#{action}.sh") + type = "shell" + elsif File.exist?("#{@basePath}/helpers/#{solution}/#{action}.py") + type = "python" + end + r = RunnerWorker.new @raw ENV['CATALOG_LOCATION'] = "#{@basePath}"; ENV['ES_SOLUTION'] = solution; @@ -53,11 +59,20 @@ parameters = Template.new.processString(parameters, {}) if (type == "ruby") cmd = "ruby #{@basePath}/helpers/#{solution}/#{action}.rb '#{parameters}'" + elsif (type == "python") + cmd = "python #{@basePath}/helpers/#{solution}/#{action}.py '#{parameters}'" else - cmd = "#{@basePath}/helpers/#{solution}/#{action}.sh \"#{parameters}\"" + argList = [] + args = JSON.parse(parameters) + args.each do | k | + argList.push('--' + k[0]) + argList.push('"' + k[1] + '"') + end + + cmd = "#{@basePath}/helpers/#{solution}/#{action}.sh #{argList.join(' ')}" end r.run cmd, 1, 1, status rescue => exception @log.error(cmd)