1 Reply Latest reply on Jan 5, 2011 11:15 AM by Michael Torres

    jli.run namespace command without arguments

    Michael Torres

      The following jython code snippet depicts a jli.run method execution of two BladeLogic namespace commands. The first call is to a namespace command with arguments, and the second is a call to a Namespace command without arguments.  The second call to jli.run that will run as a subsequent call to the first.

       

      Although I have solved this issue by creating a complex command via XML processing, I'd like to know if is only possible to use the jli.run(cmd) with Namespace commands that have no arguments. I've seen other examples that I need to use the empty python array [], but that did not work for me.

       

      This example passes the assertion tests,

          nameSpace = 'NSHScript'
          blcliCmd = 'getDBKeyByGroupAndName'

          cmd = []
          cmd.append(nameSpace)
          cmd.append(blcliCmd)
          cmd.append(str(group))
          cmd.append(str(name))

          try:
              update = jli.run(cmd)
              assert update.success(), update.getError()  #*** This reports the error.
          except AssertionError,e:
              print e

       

      But when the script calls a method that does not have a command argument, an error is generated.    cmd = []

          NameSpace = 'NSHScript'

          blcliCmd = 'getNSHParams'

          cmd.append(NameSpace)

          cmd.append(blcliCmd)

          try:

              update = jli.run(cmd)

              assert update.success(), update.getError()  #*** This reports the error.

          except AssertionError,e:

              print e

       

      The Assertion test fails with this error.......

      DBKey:SDepotObjectKey:2015674-1

      com.bladelogic.cli.factory.CommandNotFoundException: R: Cannot find command : NSHScript, getNSHParams

       

      Thanks

        • 1. Re: jli.run namespace command without arguments
          Michael Torres

          After reading the following bmc community posts,

          http://communities.bmc.com/communities/message/128078#128078

          Unreleased commands information

          http://communities.bmc.com/communities/thread/37774

          and reviewing community posted blcli xml configuration information, it is concluded that these are the steps to fixing the issue.

           

          When your jython script script receives this error -->  com.bladelogic.cli.factory.CommandNotFoundException: R: Cannot find command :      NSHScript,      getNSHParams

           

          follow these steps:

          1. cd to the BladeLogic root's xml/cli directory

          2. look for the method getNSHParams in the files located in the directory noted in step 1

          3. if you see this setting (see in bold)

                  <api_command command_id="getNSHParams-DEFAULT-7476"

                      published="no" release="no">

          4. you can address the "Cannot find command:" error by adding the following line to the bljython script's java execution.

              -Dcom.bladelogic.cli.debug.release-only=false