7 Replies Latest reply on Oct 7, 2008 5:40 PM by Bill Robinson

    BLCLI Command Entry

      I have a general question about using BLCLI. In my onboarding labs, there is a question that reads:


      6. What is the BLCLI command and syntax to create a simple deploy job based on a BLPackage? [78]
      1. Manually create a simple BLPackage in the Depot that applies some minor change
      to a server. Use the BLCLI to create a deploy job and execute it against a server.


      I've found the command to do this, but am having some problems with the implementation. The above question seems to insinuate that this should be accomplished by typing in a single, discrete command. However, when I read the documentation, it seems to imply a much different scenario.


      In the documentation, I am led to believe that I need to create a script that can store variables such as groupId and packageKey. Other BLCLI commands seem to be much the same with a lot of calls such as getDBKeyByGroupAndName for instance. The need to have multiple (int) ID's in a single command appear to necessitate to use of a script file rather than a single command entered at the prompt.


      My question is, is it possible to do something like create a deployment job in a single, self contained command or will I need to create a .nsh script for everything short of the absolute most basic commands that do not require a series of IDs and other arguments?

        • 1. Re: BLCLI Command Entry
          Bill Robinson

          If you have the dbkey, etc then it's just 1 blcli command - i think that's what the question is looking for.


          but in reality you need a script (nsh, jython, etc) to find the dbkey, find other stuff and then create the package....


          of course you could string the command together on one line w/ ;'s ;)

          • 2. Re: BLCLI Command Entry

            Ah, this is the insight I needed. I was getting to the point where I was running separate commands to pull the ID's (integers) I needed to plug into main command manually. Knowing that these are all supposed to go into a script really takes the mystery out of it. Thank you very much.

            • 3. Re: BLCLI Command Entry
              Bill Robinson

              if you're running alot of blcli in 1 script you should look at the 'performance commands' in the blcli docs. it's the same namespaces and commands, it just keeps everything in 1 jvm.


              look in the kb for some example scripts that show you how to do stuff w/ blcli - look for like 'ad sync' or find the blcli section in the kb...

              • 4. Re: BLCLI Command Entry

                I'm having the hardest time getting my first script off of the ground. I'm trying, for now, to simply do a script that will create a Update Server Properties Job. I've found the "hidden" documentation for this and it looks fairly striaghtforward, but I can't seem to get it quite right.



                TARGET_GROUP="/Sample Workspace/All Servers"

                blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup myUSPJob $JOB_GROUP $TARGET_GROUP



                The above code is nearly straight out of the documentation. Once I get this to run successfully, the rest should fall in place quite nicely. The problem is, every time I run this script, I end up with the dreaded "Found command but with mismatching arguments." unknown command warning.


                I'm convinced that I'm just missing something silly easy. But there are so many different things the problem could be. Any help to get me off of the ground with my first NSH script would be greatly apprecaited.

                • 5. Re: BLCLI Command Entry

                  You might want to try putting double quotes around your variable references:


                  blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup myUSPJob "$JOB_GROUP" "$TARGET_GROUP"


                  Best bet is to always echo out what you think should be working. For example, try doing this:


                  echo "blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup myUSPJob $JOB_GROUP $TARGET_GROUP"


                  And then paste the output that it produces into a command prompt.

                  • 6. Re: BLCLI Command Entry

                    I've tried the suggest solutions posted above with no luck. I am basing my work on this issue off of the "unsupported" blcli namespace "UpdateServerPropertyJob". The documentation for the command I'm working with in the namespace is as follows.


                    Command Name : createUpdateServerPropertyJobWithTargetGroup

                    Name space : UpdateServerPropertyJob

                    Command Type : Complex

                    Release command : false

                    Author :
                    Nik Gregory
                    Description :
                    This command creates a Update Server Property Job that is run against one server group.

                    The jobGroupName argument provides the fully qualified path to the parent group.

                    The targetGroupName argument provides the target group for the new Update Server Property job.

                    This command returns a handle to the newly created Update Server Propery Job.

                    The handle can be used in other commands that need to reference the Update Server Property Job.

                    Return type : DBKey
                    Command Input :
                    Variable Name Variable Type Description
                    jobName String Name of the job.
                    jobGroupName String Fully qualified path to the parent group for this job.
                    targetGroupName String Name of the initial target server group.


                    The following example creates an Update Server Property Job with a single target group:




                    JOB_KEY=`blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup nocUSPJob $JOB_GROUP $TARGET_GROUP`

                    Invoked commands in order :
                    Command Input Return value stored name
                    ServerGroup.groupNameToDBKey $targetGroupName$ groupKey
                    JobGroup.groupNameToId $jobGroupName$ jobGroupId
                    Job.createJobObject UpdateServerPropertyJob $jobName$ NAMED_OBJECT=jobGroupId -
                    Job.addSJobDeviceGroup NAMED_OBJECT=groupKey -
                    Job.create no input -
                    Job.getDBKey no input jobKey


                    If I read this correctly, it tells me to run the command essentially as such:



                    blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup $JOB_NAME $JOB_GROUP $SERVER_GROUP


                    I've tried every combination of quotes, no quotes, spaces, variable order, etc etc etc with no luck. So, I got to playing around with the NUMBER of variables. I've run into some interesting problems. I'm beginning to wonder if there is not a bug in this version. I'm running


                    As I said, I started playing with the number of variables that I passed and ran into inexplicable behavior. Here is what I did.


                    SERVER_GROUP="/Sample Workspace/All Servers"

                    blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup "arg1" "arg2" "arg3" "arg4"


                    At first, I was running the script with the appropriate $SERVER_GROUP, $JOB_GROUP and $JOB_NAME variables. Getting nowhere, and suspecting that I was calling the folders incorrectly, I decided to replace my variables with the "arg1" (etc) for a total of 4 arguments.


                    I ran the script with 4 arguments and I got the following error:


                    Unknown command : name space = 'UpdateServerPropertyJob', command = 'createUpdat
                    eption: Found command 'UpdateServerPropertyJob.createUpdateServerPropertyJobWith
                    TargetGroup' but with mismatching arguments.


                    This did not concern me as I had intentionally put in quite a few errors. (Wrong number of arguments, incorrectly formatted variables)

                    However, I took out my "arg4" which left me with only 3 arguments, which is the number called for by the documentation. This time, I got a different error:


                    Unknown command : name space = 'UpdateServerPropertyJob', command = 'createUpdat
                    eption: R: Cannot find command : UpdateServerPropertyJob, createUpdateServerProp


                    Now, with the correct number of arguments, it's telling me that the command is UNKNOWN. Scratching my head, I reduced the number of arguments to 2.

                    This time, I got the command was found, but with mismatching arguments like I got with 4 arguments.


                    Getting back to my actual script, it reads as follows:


                    SERVER_GROUP="/Sample Workspace/All Servers"

                    blcli UpdateServerPropertyJob createUpdateServerPropertyJobWithTargetGroup $JOB_NAME $JOB_GROUP $SERVER_GROUP

                    echo "\nScript complete."


                    When I run my script as it reads above I get the "mismatched arguments" error similar to when I run the script with 2 or 4 arguments.

                    However, when I run the above with quotes around the arguments ("$JOB_NAME" "$JOB_GROUP" etc), I get the "Unknown Command" error, NOT the "mismatched arguments" error.


                    I'm sitting here with Pete Reuter doing some shadowing.

                    While we were doing some scripting for the customer, I mentioned the problem I was having with this script.

                    We looked at what I was doing on this machine and could not make heads or tails of what was going on or how to get this thing to do what it is supposed to do.

                    Can anyone enlighten me on why I'm seeing the behavior I am with the error codes versus the number of arguments and can anyone see where I'm going wrong with my actual script.

                    Again, my intention for this phase of the script is to run it successfully with no errors and to be able to open the OM GUI and see my new job sitting there.

                    Once I can get to that point, I'll move on to the next step of getting the script to actually execute the new job.


                    As always, any and all help is greatly appreciated.

                    • 7. Re: BLCLI Command Entry
                      Bill Robinson

                      to access the unreleased commands you need to pass the blcli (or blcli2) on windows some specific debug options. or you need to us the 'performance commands' - start an nsh shell and use 'blcli_execute' instead of blcli - the unreleased commands are enabled in this context.