Reputation: 1
I need a little help with a process we're trying to build that should be able to react dynamically.
The process goes a little something like this. User will submit a process request against an environment, submitting an array of string values as a runtime value. The process will take these in, as an array in bash, and loop through them, checking them against a predefined string list for validity. Upon finding they are valid, reacting differently based off of which values are in the string.
Example:
User submits a process request with values "abc", "bcd", "cde", "def"
Values "abc", "bcd", and "def"
are valid.
We do a bit of manipulation to make them usable:
echo ${p:inputArray}
inputArray="${p:inputArray}"
inputArray=${inputArray//]/}
inputArray=${inputArray//[/}
inputArray=${inputArray//,/}
inputArray=( "${inputArray[@],,}" )
Then loop through each value and react:
for inputValue in $inputArray; do
if [[ "${validInputArray[@]}" =~ "${inputValue}" ]]; then
// Check if value is the outlier case "A"
// Or if the value is normal (but multiple) case "B"
// If case "B" then we'll build a variable for it
// It should be something like ${p:environment/$inputValue.action}
This, ideally, would give me the value of ${p:environment/abc.action} for example. But it does not. It gives me a string. I have no way to evaluate the dynamically created property request, as all properties are evaluated at initialization and not on the fly.
We can handle it via a "case" method - but it's a bit ugly, and will only get uglier as our number of valid inputs grow.
Upvotes: 0
Views: 1425
Reputation: 316
Instead of sending it an array of values, you can configure UCD to prompt them for specific values. You can do this on the application process. That way, when the user kicks off the deployment, there is no guessing on the validity of the input.
On the process page of the application, click on the Application Process Properties link
From there, you can configure it to require a certain pattern (checked via regex), or explicit values from a drop down, raw text, dateTime, etc. Here, I've configured a property with a multi-select to allow specific JVM maximum heap values. By limiting this to specific values, you can avoid typos and failed deployments.
Once configured, when you launch your process, you are presented with the property in the interface:
Upvotes: 0