When to use [ and { in JBoss CLI

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x

Issue

  • Need explaination what is the use of "[" and "{" in CLI?
  • Where to use square braket "[" and curly bracket "{" in CLI?
  • Is there any documentation which can explain how to use "[" and "{" in CLI?
  • Why the following CLI command fails while trying to add module-options as follows:

    /subsystem=security/security-domain=testSecurityDomain/authentication=classic:add(login-modules=[{code=>org.jboss.security.auth.spi.RunAsLoginModule,flag=>optional,module-options=>["ABC"=>"XYZ"]}])
    

Resolution

If the attribute being specified is of type OBJECT, will need to use curly brackets { and name=value pairs. For attributes of type LIST, must use square brackets [ and a list of values.

To find the type use the CLI :read-resource-description command.

Example of a OBJECT:

/subsystem=security/security-domain=ADRealm/authentication=classic/login-module=LdapExtended-Module:read-resource-description
...
            "module-options" => {
                "type" => OBJECT,
                "description" => "List of module options containing a name/value pair.",

Example of a LIST:

/profile=full-ha/subsystem=web/connector=http:read-resource-description
...
            "virtual-server" => {
                "type" => LIST,
                "description" => "The list of virtual servers that can be accessed through this connector. The default is to allow all virtual servers.",

/subsystem=web/connector=http2:add(virtual-server=["test","test2"], ...

See Resource Attribute Details for further information.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments