6 Replies Latest reply on Aug 20, 2017 3:54 AM by jaikiran pai

    Wildfly 10 : cannot remove a global module from value

    Nicolas Ramos Newbie

      Hi,

       

      I'm writing some cli scripts through rhino implementation for our wildfly10 farm.

       

      I try to implement removing for global-module that could be created by administrators. The cli script is ok when i remove the global-module with the index option.

       

      Here's the global-module of the subsystem ee section :

       

      /subsystem=ee:read-attribute(name="global-modules")

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

      Reponse: {

          "outcome" => "success",

          "result" => [{

              "name" => "javax.jms.api",

              "slot" => "main"

          }]

      }

       

      Removing

       

      /subsystem=ee:list-remove(name="global-modules",index=0)

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@5b94b04d

      Reponse: {"outcome" => "success"}

      /:reload

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@8c3b9d

      Reponse: {

          "outcome" => "success",

          "result" => undefined

      }

       

      List

       

      /subsystem=ee:read-attribute(name="global-modules")

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

      Reponse: {

          "outcome" => "success",

          "result" => undefined

      }

       

      In this case, when i try to remove with the index option, it works.

       

      But in this case, with the value option, it fails :

       

      /subsystem=ee:read-attribute(name="global-modules")

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

      Reponse: {

          "outcome" => "success",

          "result" => [{

              "name" => "javax.jms.api",

              "slot" => "main"

          }]

      }

       

      /subsystem=ee:list-remove(name="global-modules",value="javax.jms.api")

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@1f59a598

      Reponse: {"outcome" => "success"}   ??

       

      /subsystem=ee:read-attribute(name="global-modules")

      Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

      Reponse: {

          "outcome" => "success",

          "result" => [{

              "name" => "javax.jms.api",

              "slot" => "main"

          }]

      }

       

      --> the global-module is still there.

       

      Any ideas ?

       

      The wildfly version we are using is : WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final)

       

      Thank you by advance !

       

      Source : Wildfly Model Reference

        • 1. Re: Wildfly 10 : cannot remove a global module from value
          jaikiran pai Master

          Nicolas Ramos wrote:

           

          But in this case, with the value option, it fails :

           

          /subsystem=ee:read-attribute(name="global-modules")

          Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

          Reponse: {

          "outcome" => "success",

          "result" => [{

          "name" => "javax.jms.api",

          "slot" => "main"

          }]

          }

           

          /subsystem=ee:list-remove(name="global-modules",value="javax.jms.api")

          Result: org.jboss.as.cli.scriptsupport.CLI$Result@1f59a598

          Reponse: {"outcome" => "success"} ??

           

          /subsystem=ee:read-attribute(name="global-modules")

          Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

          Reponse: {

          "outcome" => "success",

          "result" => [{

          "name" => "javax.jms.api",

          "slot" => "main"

          }]

          }

           

          --> the global-module is still there.

           

          Any ideas ?

           

           

          I have a suspicion that this list-remove operation is not really removing the entry since the value to remove is expected to be a OBJECT type (for this specific global-modules attribute) and it's being passed a string instead. I haven't checked the code so not 100% sure about it. Furthermore, I'm not sure what the expectation of list-remove operation is if it doesn't remove any element (since none matched) - should return a outcome as a failure or should it return it as successful (like it does currently). @ctomc or brian.stansberry might know more about that.

          • 2. Re: Wildfly 10 : cannot remove a global module from value
            Claudio Miranda Novice

            As Jaikiran pointed out, list-remove must pass an object as parameter, see this example:

             

            add sample modules

            /profile=full/subsystem=ee:list-add(name=global-modules,value={name="module1", slot="slot1"})

            /profile=full/subsystem=ee:list-add(name=global-modules,value={name="module2", slot="slot2"})

             

            remove it

            /profile=full/subsystem=ee:list-remove(name=global-modules,value={name="module2", slot="slot2"})

            • 3. Re: Wildfly 10 : cannot remove a global module from value
              Nicolas Ramos Newbie

              Hi, thank you for you reply.

               

              The remove command you gave me doesn't work.

               

              1/ ADD

               

              /subsystem=ee:list-add(name=global-modules,value={name="javax.jms.api",slot="main"})

              Result: org.jboss.as.cli.scriptsupport.CLI$Result@1757cd72

              Reponse: {"outcome" => "success"}

              /:reload

              Result: org.jboss.as.cli.scriptsupport.CLI$Result@445b295b

              Reponse: {

                  "outcome" => "success",

                  "result" => undefined

              }

               

               

               

              2/ REMOVE

               

              /subsystem=ee:list-remove(name=global-modules,value={name="javax.jms.api",slot="main"})

              Result: org.jboss.as.cli.scriptsupport.CLI$Result@6aaceffd

              Reponse: {"outcome" => "success"}

              /:reload

              Result: org.jboss.as.cli.scriptsupport.CLI$Result@c86b9e3

              Reponse: {

                  "outcome" => "success",

                  "result" => undefined

              }

               

              3/ READ

               

              /subsystem=ee:read-attribute(name="global-modules")

              Result: org.jboss.as.cli.scriptsupport.CLI$Result@291caca8

              Reponse: {

                  "outcome" => "success",

                  "result" => [{

                      "name" => "javax.jms.api",

                      "slot" => "main"

                  }]

              }

               

               

              --> the global-module is still there

               

               

               

               

              When i read the operation description, value is not an object but clearly a "STRING" :

               

              /subsystem=ee:read-operation-description(name=list-remove)

              {

                  "outcome" => "success",

                  "result" => {

                      "operation-name" => "list-remove",

                      "description" => "Remove entry from list attribute",

                      "request-properties" => {

                          "name" => {

                              "type" => STRING,

                              "description" => "Name of list attribute to remove entry from",

                              "expressions-allowed" => false,

                              "required" => true,

                              "nillable" => false,

                              "min-length" => 1L,

                              "max-length" => 2147483647L

                          },

                         "value" => {

                              "type" => STRING,

                              "description" => "Value remove from list",

                              "expressions-allowed" => false,

                              "required" => false,

                              "nillable" => true,

                              "min-length" => 1L,

                              "max-length" => 2147483647L

                          },

                          "index" => {

                              "type" => INT,

                              "description" => "Optional 0 based index to tell what element to remove",

                              "expressions-allowed" => false,

                              "required" => false,

                              "nillable" => true

                          }

                      },

                      "reply-properties" => {},

                      "read-only" => false,

                      "runtime-only" => true

                  }

              }

               

               

              Are you sure it's not a bug ?

               

              Thanks !

              • 4. Re: Wildfly 10 : cannot remove a global module from value
                Claudio Miranda Novice

                I run your commands into my local WildFly 10.0.0.Final and it removed correctly. What is the exact version of your wildfly ?

                • 5. Re: Wildfly 10 : cannot remove a global module from value
                  Nicolas Ramos Newbie

                  Thank you for reply.

                   

                  Here is the version : WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) / Java Hotspot 1.8.0_102 / Centos 7.3

                   

                  As i said, through rhino scripts, using jboss-cli-client.jar, it does not work.

                   

                  MANIFEST.MF of this jar :

                   

                  Manifest-Version: 1.0

                  Implementation-Title: WildFly: Command line interface

                  Implementation-Version: 2.2.0.Final

                  Archiver-Version: Plexus Archiver

                  Java-Version: 1.8.0_101

                  Built-By: jperkins

                  Scm-Connection: scm:git:git@github.com:wildfly/wildfly-core.git/wildfl

                  y-cli

                  Specification-Vendor: JBoss by Red Hat

                  Os-Arch: amd64

                  Specification-Title: WildFly: Command line interface

                  Implementation-Vendor-Id: org.wildfly.core

                  JBossAS-Release-Version: 2.2.0.Final

                  Java-Vendor: Oracle Corporation

                  Os-Name: Linux

                  Scm-Url: https://github.com/wildfly/wildfly-core

                  Implementation-Vendor: JBoss by Red Hat

                  Main-Class: org.jboss.as.cli.CommandLineMain

                  Os-Version: 4.6.4-301.fc24.x86_64

                  Scm-Revision: df15bbc390766054c7090932cb033f2898a18b11

                  JBossAS-Release-Codename: Kenny

                  Created-By: Apache Maven 3.3.9

                  Build-Jdk: 1.8.0_101

                  Specification-Version: 2.2.0.Final

                  Implementation-URL: http://www.jboss.org/wildfly-core-parent/wildfly-c

                  li

                   

                  But interactivly, it works ...

                   

                  [standalone@localhost:9993 /] /subsystem=ee:read-attribute(name="global-modules")

                  {

                      "outcome" => "success",

                      "result" => [{

                          "name" => "javax.jms.api",

                          "slot" => "main"

                      }]

                  }

                  [standalone@localhost:9993 /] /subsystem=ee:list-remove(name=global-modules,value={name="javax.jms.api",slot="main"})

                  {"outcome" => "success"}

                  [standalone@localhost:9993 /] /subsystem=ee:read-attribute(name="global-modules")

                  {

                      "outcome" => "success",

                      "result" => []

                  }

                  [standalone@localhost:9993 /]

                   

                  And of course, i do not need interactive cli .... ;o) Only rhino script + jboss-cli-client.jar.

                  • 6. Re: Wildfly 10 : cannot remove a global module from value
                    jaikiran pai Master

                    Can you attach the (Rhino) script which reproduces this and show us the command you use to run it?