9 Replies Latest reply on May 15, 2014 11:55 AM by Krishna Vaddadi

    What is wrong in attached custom blcli function

    Krishna Vaddadi

      Hi

      The attached custom blcli function is not working for me no matter whatever I have changed in the file, name of the file,... and restarted the services (umpteen times). I am always getting the message:

       

      blcli_execute NSHScriptJob startNSHJob ${jobFolder} ${jobName}

      Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundExc

      eption: Name space : NSHScriptJob has no commands by name : startNSHJob

       

      However when I execute the same commands individually (part of the complex function), the NSH Script job starts successfully [as mentioned below]

      blcli_execute NSHScriptJob getDBKeyByGroupAndName ${jobFolder} ${jobName}

      blcli_storeenv jobDBKey

      blcli_execute NSHScriptJob executeJobGetJobResultKey ${jobDBKey}

       

      Can someone please correct / suggest what is wrongly formatted in the attached xml file

      thanking in advance...

        • 1. Re: What is wrong in attached custom blcli function
          Bill Robinson

          <?xml version="1.0" encoding="UTF-8"?>

          <!DOCTYPE command_inventory SYSTEM "file://bladelogic.com/dtds/Command-Inventory.dtd">

          <command_inventory>

            <name_space name="NSHScriptJob">

              <complex_command command_id="startNSHJob-DEFAULT-0001" published="yes" release="yes">

                <name>startNSHJob</name>

                <description/>

                <argument_list>

                  <argument desc="Full path to the job group containing the NSH Script Job." name="jobFolder">java.lang.String</argument>

                  <argument desc="NSH Script Job Name." name="jobName">java.lang.String</argument>

                </argument_list>

                <commands_to_execute>

                  <command_invocation>

                    <namespace_ref>NSHScriptJob</namespace_ref>

                    <name>getDBKeyByGroupAndName</name>

                    <input>$jobFolder$</input>

                    <input>$jobName$</input>

                    <store_result>

                    <name>jobDBKey</name>

                    </store_result>

                  </command_invocation>

                  <command_invocation>

                    <namespace_ref>NSHScriptJob</namespace_ref>

                    <name>executeJobGetJobResultKey</name>

                    <input>NAMED_OBJECT=jobDBKey</input>

                  </command_invocation>

                </commands_to_execute>

              </complex_command>

            </name_space>

          </command_inventory>

          • 2. Re: What is wrong in attached custom blcli function
            Krishna Vaddadi

            Hi Bill, I am still getting the same error, am I missing something, tried restarting the service and checked...

            • 3. Re: What is wrong in attached custom blcli function
              Bill Robinson

              Where are you putting this file and how are you trying to use it ?  web services, blcli (from where) ?

              • 4. Re: What is wrong in attached custom blcli function
                Krishna Vaddadi

                Bill, I am saving this file in ...\BMC Software\BladeLogic\NSH\br\xml\cli.

                I am also seeing one csv file "internal-command-index.csv" which is literally mentioning each file in this folder and the functions it has, not sure if I need to add this custom call in this file (did not see any mention of this file in any other posts though). BBSA version is 8.3.00.115

                 

                I am testing this both from blcli and webservice request.

                1. from WS call following is the output:

                ==============================

                <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

                   <soapenv:Body>

                      <soapenv:Fault>

                         <faultcode>soapenv:Server</faultcode>

                         <faultstring>CommandNotFoundException</faultstring>

                         <detail>

                            <ns6:CommandNotFoundException xmlns:ns6="http://bladelogic.com/webservices/skeleton/clitunnel">

                               <ns6:CommandNotFoundException xsi:type="ns2:CommandNotFoundException" xmlns:ns2="http://bladelogic.com/webservices/cli/factory/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                                  <Exception xsi:type="s1:string" xmlns:s1="http://www.w3.org/2001/XMLSchema">Name space : NSHScriptJob has no commands by name : startNSHJob</Exception>

                               </ns6:CommandNotFoundException>

                            </ns6:CommandNotFoundException>

                         </detail>

                      </soapenv:Fault>

                   </soapenv:Body>

                </soapenv:Envelope>

                =========================================================

                2. while from blcli it is:

                IVCSW70006080-V% blcli_execute NSHScriptJob startNSHJob ${jobFolder} ${jobName}

                Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundExc

                eption: Name space : NSHScriptJob has no commands by name : startNSHJob

                IVCSW70006080-V%

                • 5. Re: What is wrong in attached custom blcli function
                  Bill Robinson

                  If you are running this from WS, then you need to put the xml file in NSH/br/server_xml/cli on the bsa appserver(s) running WS.

                   

                  For the blcli, you need to put the file in NSH/br/xml/cli on the system that you are running the blcli binary from.

                  • 6. Re: What is wrong in attached custom blcli function
                    Krishna Vaddadi

                    thanks Bill, this time it has recognized the call, however its failing with a syntax error:

                    ErrorMay 15, 2014 10:58:48 AMCommand execution failed. com.bladelogic.om.infra.cli.factory.CommandLoadException: Failed to parse xml command file : D:\Program Files\BMC Software\BladeLogic\NSH\br\xml\cli\NSHScriptJob-PS-1.xml: java.lang.Exception: Failed to parse file : D:\Program Files\BMC Software\BladeLogic\NSH\br\xml\cli\NSHScriptJob-PS-1.xml
                    ErrorMay 15, 2014 10:58:49 AMError was at line 21 and column 30: org.xml.sax.SAXParseException: The content of element type "command_invocation" must match "(namespace_ref,name,input,store_result?)".
                    • 7. Re: What is wrong in attached custom blcli function
                      Krishna Vaddadi

                      Thanks Bill for correcting, after copying to server_xml its working fine for WS. I noticed that for WS appservice restart is required while for blcli its sufficient if I am launching a new connection, now its working from both the places.

                      • 8. Re: What is wrong in attached custom blcli function
                        Bill Robinson

                        ok, btw, it should be like the below - there should be only one input tag for the getDBKeyByGroupAndName.

                         

                        <?xml version="1.0" encoding="UTF-8"?>

                        <!DOCTYPE command_inventory SYSTEM "file://bladelogic.com/dtds/Command-Inventory.dtd">

                        <command_inventory>

                          <name_space name="NSHScriptJob">

                            <complex_command command_id="startNSHJob-DEFAULT-0001" published="yes" release="yes">

                              <name>startNSHJob</name>

                              <description/>

                              <argument_list>

                                <argument desc="Full path to the job group containing the NSH Script Job." name="jobFolder">java.lang.String</argument>

                                <argument desc="NSH Script Job Name." name="jobName">java.lang.String</argument>

                              </argument_list>

                              <commands_to_execute>

                                <command_invocation>

                                  <namespace_ref>NSHScriptJob</namespace_ref>

                                  <name>getDBKeyByGroupAndName</name>

                                  <input>$jobFolder$ $jobName$</input>

                                  <store_result>

                                  <name>jobDBKey</name>

                                  </store_result>

                                </command_invocation>

                                <command_invocation>

                                  <namespace_ref>NSHScriptJob</namespace_ref>

                                  <name>executeJobGetJobResultKey</name>

                                  <input>NAMED_OBJECT=jobDBKey</input>

                                </command_invocation>

                              </commands_to_execute>

                            </complex_command>

                          </name_space>

                        </command_inventory>

                        • 9. Re: What is wrong in attached custom blcli function
                          Krishna Vaddadi

                          Yes Bill I too corrected it at my end and also changed the variable name to jobKey instead of jobDBKey (for consistency):

                           

                          <?xml version="1.0" encoding="UTF-8"?>

                          <!DOCTYPE command_inventory SYSTEM "file://bladelogic.com/dtds/Command-Inventory.dtd">

                          <command_inventory>

                            <name_space name="NSHScriptJob">

                              <complex_command command_id="startNSHJob-DEFAULT-0001" published="yes" release="yes">

                                <name>startNSHJob</name>

                                <description/>

                                <argument_list>

                                  <argument desc="Full path to the job group containing the NSH Script Job." name="jobFolder">java.lang.String</argument>

                                  <argument desc="NSH Script Job Name." name="jobName">java.lang.String</argument>

                                </argument_list>

                                <commands_to_execute>

                                  <command_invocation>

                                    <namespace_ref>NSHScriptJob</namespace_ref>

                                    <name>getDBKeyByGroupAndName</name>

                                    <input>$jobFolder$ $jobName$</input>

                                    <store_result>

                                    <name>jobKey</name>

                                    </store_result>

                                  </command_invocation>

                            <command_invocation>

                                    <namespace_ref>NSHScriptJob</namespace_ref>

                                    <name>executeJobGetJobResultKey</name>

                                    <input>NAMED_OBJECT=jobKey</input>

                                  </command_invocation>

                                </commands_to_execute>

                              </complex_command>

                            </name_space>

                          </command_inventory>