When to use "[" and "{" in CLI.

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.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 you are specifying is of type OBJECT, you need to use curly brackets "{" and name=value pairs
For attributes of type LIST you use square brackets "[" and a list of values

You can find the type by using the CLI :read-resource-description command.

Example:

/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.",

So an example of the usage:

/profile=full-ha/subsystem=security/security-domain=SPNEGO/authentication=classic/login-module="SPNEGOUsers-Module":add(code="SPNEGOUsers",flag=requisite, module-options={"password-stacking" => "useFirstPass", "serverSecurityDomain" => "kdc2008.jbossuk.com", "removeRealmFromPrincipal" => "true"})

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"], ...

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.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.