Hi, I'd like to create an output property from a shell step in order to be used in a following step of a process. From the shell script I'd like to create the property.
Is it possible? How can I do this?
Thanks, Michele
Answer by Moogly (43) | May 27, 2015 at 07:44 PM
You have to use the post processing script http://www-01.ibm.com/support/knowledgecenter/SS4GSP_6.0.1/com.ibm.udeploy.doc/topics/comp_postProcess.html?lang=en
Post Processing script will read the results from Shell and you can able to assign the values to property. In my case I have assigned the value in shell like "YourOutput=myValue10102455", then post processing script will read "YourOutput" string and assign
var exit = properties.get('exitCode');
scanner.register("regex", function(lineNumber, line) { var thing = 'do stuff'; });
if (exit == 0) { properties.put('Status', 'Success') scanner.register("^YourOutput", function(lineNumber, line) { var temp=line.split("="); var out=temp[1]; properties.put("YourPropertyName",out); }); scanner.scan(); } else { properties.put('Status', 'Failure'); }
Answer by Greg_P_SM (16) | Jun 01, 2015 at 12:01 PM
If you're open to using a Groovy script ("Run Groovy Script" step), you get access to inProps
(input Properties) and outProps
(output Properties). For example:
outProps.put("foo", "bar")
Primarily for use with shell scripts, I also have a post-processing script that extracts foo=bar
from output:
var i = 0;
scanner.register("^[\\w\\-\\.]+=.+$", function(aLineNumber, aLine) {
var parts = /^([\w\-\.]+)=(.+)$/.exec(aLine);
if (parts == null || parts.length != 3) {
properties.put("matchedScannerNotRegex" + i++, aLine);
}
else {
properties.put(parts[1].trim(), parts[2].trim());
}
});
properties.put("Status", (properties.get("exitCode") == 0 ? "Success" : "Failure"));
scanner.scan();
UrbanCode deploy: How to pass input properties into an application process 1 Answer
How to set up the approval process? 4 Answers
Is there a way to set an output variable from a shell script in a workflow? 1 Answer
How to store udclient command's output in a variable? 0 Answers
Is it possible to change System Settings from the command line or REST API? 1 Answer