Bug 1026319

Summary: [GSS] (6.4) Wrong datasource connection-url is written in standalone.xml even if CLI script executes successfully
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Tolis Emmanouilidis <aemmanou>
Component: CLIAssignee: Alexey Loubyansky <olubyans>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kremensky <pkremens>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0, 6.2.0, 6.1.1CC: bbaranow, brian.stansberry, kkhan, kpiwko, oskutka, pkremens
Target Milestone: DR1   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tolis Emmanouilidis 2013-11-04 12:15:08 UTC
Description of problem:
JBoss EAP 6.1 Final / STANDALONE mode

When running a CLI script to create a datasource, the output is that "The batch executed successfully". However the database connection url is -1 in standalone.xml. This success response is misleading, since the correct values are not written in standalone.xml.

So the issues are:
1) connection-url is not properly written in standalone.xml
2. success message is shown even if wrong values are written in standalone.xml

Version-Release number of selected component (if applicable):
JBoss EAP 6.1.Final

How reproducible:
Start JBoss EAP 6.1 Final
Get the CLI script from https://github.com/aerogear/aerogear-unifiedpush-server/blob/0.8.1/h2-database-config.cli
Execute jboss-eap-6.1/bin/jboss-cli.sh --file=./h2-database-config.cli

Steps to Reproduce:
1. jboss-eap-6.1/bin/standalone.sh
2. jboss-eap-6.1/bin/jboss-cli.sh --file=./h2-database-config.cli
3. Check the standalone xml

Actual results:
connection-url for PushEEDS is -1

Expected results:
connection-url for PushEEDS should be jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1

Additional info:
When using double quotes: --connection-url="jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1" then the connection-url is properly written in standalone.xml

If I use the jboss-cli.sh of JBoss AS 7.1.1 Final then the connection-url is properly written even without double quotes.

Comment 1 Tolis Emmanouilidis 2013-11-05 16:54:33 UTC
I'd like to add that the issue appears when using an equality sign inside the connection-url value.

e.g: --connection-url=jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1

Comment 2 Alexey Loubyansky 2013-11-07 13:52:41 UTC
The equal sign is a special one, although in this position it could be argued that it should not be considered special. I'm gonna see what's going on there. To avoid issues with special characters you can escape or quote them. See the difference in the generated requests

[standalone@localhost:9990 /] echo-dmr data-source add --name=myds --driver-name=h2 --jndi-name=java:/myds --connection-url=jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "myds")
    ],
    "operation" => "add",
    "jndi-name" => "java:/myds",
    "connection-url" => "-1",
    "driver-name" => "h2"
}
[standalone@localhost:9990 /] echo-dmr data-source add --name=myds --driver-name=h2 --jndi-name=java:/myds --connection-url=jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY\=-1
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "myds")
    ],
    "operation" => "add",
    "jndi-name" => "java:/myds",
    "connection-url" => "jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1",
    "driver-name" => "h2"
}
[standalone@localhost:9990 /] echo-dmr data-source add --name=myds --driver-name=h2 --jndi-name=java:/myds --connection-url="jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1"
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "myds")
    ],
    "operation" => "add",
    "jndi-name" => "java:/myds",
    "connection-url" => "jdbc:h2:~/unifiedpush;DB_CLOSE_DELAY=-1",
    "driver-name" => "h2"
}

Comment 3 Alexey Loubyansky 2013-11-07 15:16:14 UTC
The equals sign in the value is treated as a name/value separator because the value parser is a general one, i.e. it can recognize all sorts of value types:
- properties of the form name=value (which is how it recognizes the given value);
- property lists: name=value(,name=value)*;
- structures, such as {a=b,c=[d,e,f]}, etc;
- etc.

One way to avoid this issue is to rely on the parameter type defined in management model, i.e. connection-url is STRING, and use a simpler value parser.

Potential problem with this approach is that, not sure how it is now, before the management model descriptions were not always accurate and STRING type could be used for parameters and properties that were in fact OBJECT, LIST, PROPERTY, etc.

Comment 4 JBoss JIRA Server 2013-11-14 11:47:33 UTC
Alexey Loubyansky <alex> updated the status of jira WFLY-2464 to Resolved

Comment 5 JBoss JIRA Server 2013-11-14 11:47:33 UTC
Alexey Loubyansky <alex> made a comment on jira WFLY-2464

Merged.

Comment 6 Alexey Loubyansky 2013-11-14 11:51:09 UTC
As in my previous comment, a simpler parser is used now for STRING types. As a consequence the equals sign does not have to be escaped in this case.