to read a property value from the job you run:
Job getFullyResolvedPropertyValue NSH_SCRIPT_JOB "/path/to/folder" "job name" "property name"
on the 2nd part - if your script you run fails, you want to return string A, if it succeeds you return string B ? is that what you are trying to do ?
Yes, effectively. But in a more general sense just looking for ways to refer data (small amount) back to parent process. We have various jobs created by various people, and we at time chain a few together, things not worth the extra effort to make into components, but more than just one script in scope. We also drive BL by a very high degree of automation, that is external blcli based, so we do not have an easy way, in some cases to return results back to the external calling process, when the result code along is insufficient.
Ok, the suggestion worked for true properties, but did not work for a job parameter. Is there a way to read a job parameter? Since this is a NSH job looks like I only have parameters (no local properties) or global properties. I really hate to create yet another global property just for this.
there might be, but you need to use the unreleased commands. try running this:
(use blcli2 if you are on windows)
blcli -Dcom.bladelogic.cli.debug.release-only="false" -m subshell
BLCLI> NSHScriptJob getDBKeyByGroupAndName "/path/to/group" "job name"
BLCLI> NSHScriptJob getNSHScriptParamValues
see what that returns. we may have to do some additional conversion. if this gets you what you want, we can create an xml file w/ the string of commands in it, and call your command like a regular blcli command.
Examples on how to use NSHScriptParam and NSHScriptParamValue namespaces?
Ok NSHScriptJob getNSHScriptParamValues does return a list of objects. The appear to NSHScriptParamValue objects, but they are rather cryptic. I need just one parameter by name, guess I would have to walk through the list? Doing a getName on each one? Until I find the right one, then go a getValue on it?
BLCLI> NSHScriptJob getNSHScriptParamValues
[com.bladelogic.model.job.script.NSHScriptParamValueImpl@661121e4, com.bladelogic.model.job.script.NSHScriptParamValueImpl@b0b79ead, com.bladelogic.model.job.script.NSHScriptParamValueImpl@894f22bf, com.bladelogic.model.job.script.NSHScriptParamValueImpl@ca887e06, com.bladelogic.model.job.script.NSHScriptParamValueImpl@8961f404, com.bladelogic.model.job.script.NSHScriptParamValueImpl@892b8490, com.bladelogic.model.job.script.NSHScriptParamValueImpl@892b6f9c, com.bladelogic.model.job.script.NSHScriptParamVal
ueImpl@1c751117, com.bladelogic.model.job.script.NSHScriptParamValueImpl@f5cc273d, com.bladelogic.model.job.script.NSHScriptParamValueImpl@892ab389, com.bladelogic.model.job.script.NSHScriptParamValueImpl@d75bffa7, com.bladelogic.model.job.script.NSHScriptParamValueImpl@2eee0d13]
after the >NSHScriptJob getNSHScriptParamValues
What does it work? If I don't pass any parameters?
right now we're running in the "subshell" mode, so the object you're acting on is in memory, so the 'getName' command reads out of memory.
did this string of commands get you what you want?
we can turn this into an xml file and you can then reference it like the rest of the normal blcli commands ...
getName returns, the name of the job only.
Re-stating the question... I can get a list of parameter objects... see above, but how do I get the 'value' of any one of the listed objects?
which getName are you using:
NSHScriptParam getName - does that just return the Name of the setting? if that just returns the name, i think there are some other commands that will return the value.
btw, these are all from the 'unreleased' commands - do you have the documentation for those, that's where i'm pulling these from.
i can post how to generate those docs later today if you don't have them..
I have the list. And that is what is driving me nuts. :) I can not seem to get NSHScriptParam or NSHScriptParamValue to work as I expect.
In short, my job has parameters, I can set any of them, I can referenc them in the scripting, but how the heck do I read them? I have a parameter I want to change from its original value when the script first runs, to a different value just before the script ends, so the calling process, which is an external BLCLI call can reference parameter value as needed.
NSHScriptParam and NSHScriptParamValue look to be exactly what I need, but I am relatively new to BL methods, and can not see to get NSHScriptParam or NSHScriptParamValue to work for me.