in the nshscript object you need to add more parameters to pass in. these will come at $1, $2, $3 ...
this would be the same as running the script like:
./script.sh foo bar bar1 bar2 bar3
so in your script just do:
Thanks, Bill, that works. One further question - other than changing the default parameter value in the job before running it, how can the user pass alternative values to the script?
that's the only way to change the values.
What if I'm using Atrium Orchestrator to run a BL NSH job? Are there other avenues to get multiple parameters passed into the script?
If you are using AO to kick off a NSH Script Job, you must use the blcli command: blcli NSHScriptJob addNSHScriptParameterValueByGroupAndName to set the parameter values, then use the blcli to execute the job.
Note: This assumes that the parameters have been created in NSHScript itself.
Please take a look at the BLCLI help for more information on usage of the blcli command listed above.
does calling 'addNSHScriptParameterValueByGroupAndName' actually change the BL Job definition? or is it transient and only applies to this instance of the job?
that command modifies the job. there are no run-time only transient settings other than executeAgainst for the target list. i'm not sure what you mean by 'this instance of the job' ? there is only a single instance of the job.
The customer has generic scripts to provision things like windows clusters but we need to pass in things like 'cluster name', network IPs. This is to be called from AO.
So rather than have fixed defaults we need to execute against a server and pass in paramters based on user input from the AO OCP.
What I am doing is using 'Job copyJob' to copy the Job from the original to a temp jobname in a 'temp' job folder (for easy clearup) and then updating the temp job parameters, otherwise you will be updating the original Job definition, which may cause concurrency headaches, won't it?
I still can't believe this is the case, that you can't specify the paramters at runtime, like you can a server name (although that only came in 8.1 to the blcli ...)
next question if I may, as I have all this working in a test script calling BLCLI before I move to AO....
What are the number of parameter limitations?
dependant on OS / Shell?
Abstracted away thanks to Java?
ok, looks like 9 paramters when running BL 8.1 on windows calling a .cmd batch file.. to be expected I guess.
I was surprised the named paramaters dont appear in the process environment variables for the script.
One of the customer scripts has over 9 params for a single command inside the script, so partitioning it up wont work. So this lead me to think a parameter file, but then it nees to be transfered to the target. It makes me wonder that I seem to be working against the tool set and building stuff in AO that I dont need.
Is there a better way to do this? I was thinking a Deploy Job, but those kind of job do not accept parameters, and again, Im stilll stuck with a 9 pRmter limit.
Would making the NSHScript job run something onter than a cmd.exe scrip (e.g. a PowerShell) be better ?
are the parameters you are trying to pass to the script something that could be set as a property value on the target server well before the run of the script? or created as instances of a custom property class ?
where are you seeing the limit of 9?
also, i'm not sure what you mean about parameter names showing in the env vars? when you run a script, it passes in the args as arg1, arg2, etc i'm not sure why you expect the parameter names to be env vars, or what good that would do.
The limit of 9 comes from trying to call a windows .cmd file
I have change my approach from trying to run a NSHScript job to deploying a BLPackage with the script and then setting up local properties using:
DeployJob setOverriddenParameterValue "$JB_FOLDER" "$JB_NAME" "$PROP_NAME" "$PROP_VALUE"
What I had hoped was that the .cmd script could contain a line like:
echo The BL local property is ??MY_PROPERTY_NAME??
and that post deployment, and prior to it being run in the'post' step, the placeholder would be replaced with the value, e.g.:
echo The BL local property is MyPropValue
Have I missed a setting?
Is this actually possible?
Is there a better way acheive passing >9 parameters to a windows script from BladeLogic?
what is in your cmd file?