0 Replies Latest reply on Aug 21, 2019 11:58 AM by chrisla

    jboss cli and jython: for loop over objects

    chrisla

      I'm trying to loop over the hosts in a domain using jython and cli. I'm getting a type error because apparently I can't iterate over the object that's returned from the cli command. I cannot for the life of me figure out what the correct syntax is to iterate over objects.

       

       

      for host in cli.cmd(":read-children-names(child-type=host)").getResponse().get("result"):

              print "host = "+host

       

      Traceback (most recent call last):

        File "test.py", line 16, in <module>

          for host in cli.cmd(":read-children-names(child-type=host)").getResponse().get("result"):

      TypeError: 'org.jboss.dmr.ModelNode' object is not iterable

       

       

      Does anyone know of any documentation that goes a bit more in-depth than the original doc that was published on using jython? It just has very basic examples of running individual commands and doesn't go into loops or anything like that.

       

       

      Thanks!
      Chris