[
https://issues.jboss.org/browse/WFCORE-1469?page=com.atlassian.jira.plugi...
]
Thomas Darimont updated WFCORE-1469:
------------------------------------
Description:
Conditional expressions are great help for creating generic wildfly configurations with
the CLI.
Currently the {{comparison-operations}} for the {{if-expression}} are limited to
- equal (==)
- not equal (!=)
- lesser than (<)
- not lesser than (>=)
- greater than (>)
- not greater than (<=)
I'd propose an additional comparison operation: a regex based match operation with the
symbol {{~=}}
wheras the left operand is a string to match against the right operand which is a regex
string.
This would enable a simple way to do feature flag detection via partial regex matches.
The following sequence demonstrates this use case:
{code}
-Dfeatures="activemq jgroups"
{code}
{code}
if (result ~= ".*activemq.*") of /:resolve-expression(expression=${features})
echo configuring activemq
end-if
if (result ~= ".*jgroups.*") of /:resolve-expression(expression=${features})
echo configuring jgroups
end-if
if (result ~= ".*postgres.*") of /:resolve-expression(expression=${features})
echo configuring postgres
end-if
{code}
Example:
{code}
-Dfeatures="feature1 feature2"
[default@local:9990 /] if (result ~= ".*feature1.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature1
[default@local:9990 /] end-if
configuring feature1
[default@local:9990 /] if (result ~= ".*feature2.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature2
[default@local:9990 /] end-if
configuring feature2
[default@local:9990 /] if (result ~= ".*feature3.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature3
[default@local:9990 /] end-if
[default@local:9990 /]
{code}
was:
Conditional expressions are great help for creating generic wildfly configurations with
the CLI.
Currently the {{comparison-operations}} for the {{if-expression}} are limited to
- equal (==)
- not equal (!=)
- lesser than (<)
- not lesser than (>=)
- greater than (>)
- not greater than (<=)
I'd propose an additional comparison operation: a regex based match operation with the
symbol {{~=}}
wheras the left operand is a string to match against the right operand which is a regex
string.
This would enable a simple way to do feature flag detection via partial regex matches.
The following sequence demonstrates this use case:
{code}
-Dfeatures="activemq jgroups"
{code}
{code}
if (features ~= ".*activemq.*") of /:resolve-expression(expression=${features})
echo configuring activemq
end-if
if (features ~= ".*jgroups.*") of /:resolve-expression(expression=${features})
echo configuring jgroups
end-if
if (features ~= ".*postgres.*") of /:resolve-expression(expression=${features})
echo configuring postgres
end-if
{code}
Example:
{code}
-Dfeatures="feature1 feature2"
[default@local:9990 /] if (features ~= ".*feature1.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature1
[default@local:9990 /] end-if
configuring feature1
[default@local:9990 /] if (features ~= ".*feature2.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature2
[default@local:9990 /] end-if
configuring feature2
[default@local:9990 /] if (features ~= ".*feature3.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature3
[default@local:9990 /] end-if
[default@local:9990 /]
{code}
Support match-comparison operation for if-command
-------------------------------------------------
Key: WFCORE-1469
URL:
https://issues.jboss.org/browse/WFCORE-1469
Project: WildFly Core
Issue Type: Feature Request
Components: CLI
Reporter: Thomas Darimont
Assignee: Alexey Loubyansky
Priority: Minor
Conditional expressions are great help for creating generic wildfly configurations with
the CLI.
Currently the {{comparison-operations}} for the {{if-expression}} are limited to
- equal (==)
- not equal (!=)
- lesser than (<)
- not lesser than (>=)
- greater than (>)
- not greater than (<=)
I'd propose an additional comparison operation: a regex based match operation with
the symbol {{~=}}
wheras the left operand is a string to match against the right operand which is a regex
string.
This would enable a simple way to do feature flag detection via partial regex matches.
The following sequence demonstrates this use case:
{code}
-Dfeatures="activemq jgroups"
{code}
{code}
if (result ~= ".*activemq.*") of /:resolve-expression(expression=${features})
echo configuring activemq
end-if
if (result ~= ".*jgroups.*") of /:resolve-expression(expression=${features})
echo configuring jgroups
end-if
if (result ~= ".*postgres.*") of /:resolve-expression(expression=${features})
echo configuring postgres
end-if
{code}
Example:
{code}
-Dfeatures="feature1 feature2"
[default@local:9990 /] if (result ~= ".*feature1.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature1
[default@local:9990 /] end-if
configuring feature1
[default@local:9990 /] if (result ~= ".*feature2.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature2
[default@local:9990 /] end-if
configuring feature2
[default@local:9990 /] if (result ~= ".*feature3.*") of
/:resolve-expression(expression=${features})
[default@local:9990 /] echo configuring feature3
[default@local:9990 /] end-if
[default@local:9990 /]
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)