3 Replies Latest reply on Oct 24, 2016 6:48 AM by Bill Robinson

    How can I get the blcli commnad execution's returned message when executed through BLJython?

    Pedro Jose Barbero Iglesias

      Hi there,

       

      May be some one could help to retrieve the information/output or rmessage returned by a blcli commnad when being executed thorugh BLJython.

       

      The command I want to execute is:

      Screenshot_JLI_02.png

      And as you can see it is returning a failure when trying to pushACL on a server. That was the error of success I want to get ir order to proccess it.

       

      Here how I run this command from BLJython:

      Screenshot_JLI.png

      I am not asking how to know if the execution went well or right, I am trying to know can I get command execution's message return. the information regarding the object reurned in whcih i suppouse it must the message or output given when execute as blcli regular command.

       

      Any help will be appreciated.

       

      Regards.

        • 1. Re: How can I get the blcli commnad execution's returned message when executed through BLJython?
          Bill Robinson

          it's returning a job result.  you'd need to see if there's a namespace that can convert the result object into something useful.  if you run this command w/ the blcli you will get the same thing back.

          • 2. Re: How can I get the blcli commnad execution's returned message when executed through BLJython?
            Ashish Vijay

            I used something like below to get error message.

             

            from bladelogic.cli import CLI

            self.jli = CLI.CLI()

             

            blcli = [namespace, method] + str_args

                        ret = self.jli.run(blcli)

                        # print "BLCLI run."

                        if not ret.success():

                            if ret.getError().message in self.warningMessages:

                                self.logger.warning(

                                    "Error during BLCLI call: %(ns)s %(cmd)s %(params)s" % {

                                        'ns': namespace, 'cmd': method, 'params': blcli}, extra=self.logging_info)

                                self.logger.warning(

                                    "+----------------------> %s" % ret.getError().message, extra=self.logging_info)

                            else:

                                self.logger.error(

                                    "Error during BLCLI call: %(ns)s %(cmd)s %(params)s" % {

                                        'ns': namespace, 'cmd': method, 'params': blcli}, extra=self.logging_info)

                                self.logger.error(

                                    "+----------------------> %s" % ret.getError().message, extra=self.logging_info)

                            raise BSAError(blcli, ret.getError().message)

             

            But you may have to add some extra commands to get error or warning message and also you may need to do some extra logging to get some detailed information.

            1 of 1 people found this helpful
            • 3. Re: How can I get the blcli commnad execution's returned message when executed through BLJython?
              Bill Robinson

              how does your blcli function help w/ the request "I am trying to know can I get command execution's message return" ?