4 Replies Latest reply on Sep 8, 2016 8:44 AM by Steven Alexson

    BSA 8.8 GA - Determining NSH Script Job Parameter Index from Parameter Name via BLCLI

    Steven Alexson

      In BSA 8.8 GA, is there a way to use a NSH Script Job parameter "Name" and determine the parameter Index number? I have an NSH script that will create an NSH Script Job dynamically using a specified NSH Script in the BSA depot. Once the job is created, the script will set values to specific parameters (using NSHScriptJob addNSHScriptParameterValueByGroupAndName). These parameters are passed to the creation script using the parameter name. Since the target depot object can be any NSH script, it would be impossible to know the index of every parameter that may need to be set.  Is there some BLCLI command or API call that I can make to translate a parameter name to its index?

        • 1. Re: BSA 8.8 GA - Determining NSH Script Job Parameter Index from Parameter Name via BLCLI
          Bill Robinson

          it looks like you should be able to do this:

           

          # blcli_execute Job findByDBKey ${jobKey}

          com.bladelogic.om.infra.model.job.script.NSHScriptJobImpl@aa93eb32blapp88-1

          # blcli_execute NSHScriptJob getNSHScriptJobParamOptions

          [com.bladelogic.om.infra.model.job.script.NSHScriptJobParamRuntimeOptionsImpl@b543340b, com.bladelogic.om.infra.model.job.script.NSHScriptJobParamRuntimeOptionsImpl@b543342b, com.bladelogic.om.infra.model.job.script.NSHScriptJobParamRuntimeOptionsImpl@b543344b]

          # blcli_execute Utility setTargetObject

          [com.bladelogic.om.infra.model.job.script.NSHScriptJobParamRuntimeOptionsImpl@b543340b, com.bladelogic.om.infra.model.job.script.NSHScriptJobParamRuntimeOptionsImpl@b543342b, com.bladelogic.om.infra.model.job.script.NSHScriptJobParamRuntimeOptionsImpl@b543344b]

          # blcli_execute NSHScriptParam getName

          [, , ]

           

          but it doesn't pull anything - and i do have names and descriptions (also returns blank) on this job's parameters.

           

          so you know that if someone has a parameter named "thething" you'd want to set a specific value all the time ?

          • 2. Re: BSA 8.8 GA - Determining NSH Script Job Parameter Index from Parameter Name via BLCLI
            Steven Alexson

            Bill:

             

            Yeah, I played with the same set of commands, and I got the same results; an empty set. The idea is that the user can call my creation script and specify the NSH script to create a job for and one or many parameter name/value pairs. The creation script would then set only the values for the parameters specified, leaving default values for any remaining parameters. I cannot assume the user knows the order of the parameters for the script, therefore they cannot provide parameter index/value pairs.

            • 3. Re: BSA 8.8 GA - Determining NSH Script Job Parameter Index from Parameter Name via BLCLI
              Bill Robinson

              why do they need your script?  why can't they just create the job they want out of the script directly ?

              • 4. Re: BSA 8.8 GA - Determining NSH Script Job Parameter Index from Parameter Name via BLCLI
                Steven Alexson

                Bill:

                In this case, the user is using an external automation tool and needs to run BSA jobs. They are not directly BSA users. The jobs they will run need to be created dynamically and they need to be able to specify parameter values to the job. Since they do not have visibility into BSA, they cannot specify parameter indexes or rely on those indexes not changing (if the order of the parameters changes). There also is no fixed list of NSH scripts. The users can specify any existing script in BSA. Since the goal of this is for an unattended automation solution, we need it to be as flexible as possible which means allowing them to specify parameter names.