2 Replies Latest reply on Jul 11, 2017 10:31 AM by Claudio Miranda

    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"})