5 Replies Latest reply on May 6, 2015 1:34 PM by Bill Robinson

    blcli command fails after upgrade to 8.5

    Mitch S

      We upgraded BladeLogic in our test environment from 8.2.02 to 8.5.  After doing so, blcli command fails (in bold underline) in one of our scripts.


      Here is the section of code where the failure occurs.  It does not seem to fail on the first addAllowedOperation 1, but does on the second one.

      BLCLI Utility storeTargetObject template

      BLCLI Template clearAllowedOperations

      BLCLI Template addAllowedOperation 1 # Browse

      BLCLI Template addAllowedOperation 7 # Snapshot

      04/30/15 15.20.31 XXXXXX_85 : ERROR: BLCLI command failed: Template addAllowedOperation 7

      04/30/15 15.20.31 XXXXXX_85 : Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundException: Found command 'Template.addAllowedOperation' but with mismatching arguments. : java.lang.IllegalArgumentException: Input '7' cannot be converted to expected type : class com.bladelogic.om.infra.model.template.OperationType: java.lang.IllegalArgumentException: illegal value for OperationType enum 7

      i cannot to find any information on this command or it's valid parameters.  Where can I find this information?

      Also, after upgrading could there have been something obvious we didn't do/install/etc.?

      I'm not good with blcli scripting so, if an answer could be explained at an elementary level it would be greatly appreciated.


        • 1. Re: blcli command fails after upgrade to 8.5
          Bill Robinson

          can you attach the script ?

          • 2. Re: blcli command fails after upgrade to 8.5
            Edwin Lindeman

            are there mappings somewhere to map the type its looking for? example in the above code he has 7 assuming your click on Snapshot in the General tab? Thank you

            • 3. Re: blcli command fails after upgrade to 8.5
              Bill Robinson

              yes - look in the unreleased docs.  it's looking for an operation object. the command doesn't seem to have changed since 8.2 though.

              • 4. Re: blcli command fails after upgrade to 8.5
                Mitch S


                Below are snippets of the code.  I tried to include the relevant information for analysis.  In essence the task at hand is the create a blpackage and check the Browse, Snapshot and Deploy boxes (see screenshot below). Option 1 checks the Browse, 7 (when working) checks the Snapshot, and 12 (when working) checks the Deploy box.  Options 7 and 12 no long work after our jump from 8.2 to 8.5.

                I've enlarged the commands in question below.  They call a function called BLCLI_Exec which then executes a blcli_execute......

                I hope this is readable.  If there is a better way to attach files please let me know.  Pasting in this window seems odd.




                # Create BLPackage template and component(s)




                    # When we create the directory part, the path cannot contain properties that don't exist yet,

                    # so use one of the server default properties, just as a placeholder until after we add APP_PATH

                    TEMPLATE_OPTIONS="false false false true true false false false false false"


                    blcli_storeenv BLPACKAGE_TEMPLATE_DBKEY



                    # Build list of enum names and values



                    (( count = 1 ))

                    for CONFIG in $TARGET_CONFIGS; do



                        (( count = $count + 1 ))



                    LogMsg "Adding APP_PATH enum property:"

                    LogMsg "\tNames=$ENUM_NAMES"

                    LogMsg "\tValues=$ENUM_VALUES"

                    BLCLI_Exec "" Template addLocalEnumProperty "$BLPACKAGE_TEMPLATE_NAME" "$BLPACKAGE_TEMPLATE_GROUP_NAME" String "APP_PATH" "List of possible staging and deployment paths" true true false "$ENUM_NAMES" "$ENUM_VALUES" "$STAGE_PATH"


                    # Don't need TARGET.DEPLOY_ROOT any more

                    BLCLI_Exec "Editing template part path" Template editPartPath "$BLPACKAGE_TEMPLATE_GROUP_NAME" "$BLPACKAGE_TEMPLATE_NAME" DIRECTORY "??TARGET.DEPLOYPATH??" "??APP_PATH??"


                    BLCLI_Exec "" Utility storeTargetObject template

                    BLCLI_Exec "" Template clearAllowedOperations

                    BLCLI_Exec "" Template addAllowedOperation 1    # Browse
                    BLCLI_Exec "" Template addAllowedOperation 7    # Snapshot
                    BLCLI_Exec "" Template addAllowedOperation 12    # Deploy

                    #BLCLI_Exec "" Template setDescription "Do not edit this template manually unless you know what you are doing."

                    BLCLI_Exec "" Template update NAMED_OBJECT=template


                    BLCLI_Exec "Getting publish server ID" Server getServerIdByName $PUBLISH_SERVER_NAME

                    blcli_storeenv PUBLISH_SERVER_ID



                    BLCLI_Exec "Add default exclude: \"$EXCLUDE\"" TemplatePart addExcludeByName "$BLPACKAGE_TEMPLATE_GROUP_NAME" "$BLPACKAGE_TEMPLATE_NAME" "??APP_PATH??" DIRECTORY "$EXCLUDE"


                    BLCLI_Exec "Get DBKey of updated template" Template getDBKeyByGroupAndName "$BLPACKAGE_TEMPLATE_GROUP_NAME" "$BLPACKAGE_TEMPLATE_NAME"

                    blcli_storeenv BLPACKAGE_TEMPLATE_DBKEY



                    blcli_storeenv BLPACKAGE_COMPONENT_DBKEY



                    # TODO: Fix this as soon as bug in BladeLogic is fixed!

                    LogMsg "WARNING: BLPackage component NOT SAVED in the $APP application instance."

                    # Store it in the application instance (NOT WORKING)

                    # BLCLI_Exec "" Component findByDBKey $BLPACKAGE_COMPONENT_DBKEY

                    # BLCLI_Exec "" Component getAssociatedInstance

                    # blcli_storeenv INSTANCE

                    # echo "Instance: $INSTANCE"

                    # BLCLI_Exec "Saving BLPackage component in application instance" PropertyInstance setOverriddenValue "${APP_PROPERTY_CLASS}/$APP" BLPACKAGE_COMPONENT "$INSTANCE"


                    # Edit the component

                    BLCLI_Exec "" Utility storeTargetObject component

                    BLCLI_Exec "" Utility setTargetObject

                    BLCLI_Exec "" Component setDescription "Component used for publishes. Do not edit manually unless you REALLY know what you are doing."

                    BLCLI_Exec "" Component update NAMED_OBJECT=component








                # Execute a BLCLI command and check for errors

                #    If the first parameter is an empty string, nothing will be logged.

                #    If REDIR is set, then stdout will go into that file.




                if [[ -n $1 ]]; then

                    LogMsg $1



                blcli_execute "$@" >$REDIR 2>$STDERR


                if [[ $RETCODE != "0" ]]; then

                    LogMsg "ERROR: BLCLI command failed: $@"

                    LogMsg $(<$STDERR)

                    if [[ $EXIT_ON_ERROR = "Y" ]]; then

                        CleanUp $RETCODE


                        EXIT_ON_ERROR=Y    # restore default



                REDIR=$NULL    # restore default

                return $RETCODE



                • 5. Re: blcli command fails after upgrade to 8.5
                  Bill Robinson

                  yeah - i get the same issue.  looks like the options changed.



                  just look in the operation_type table:


                  1    Browse    Browse

                  2    Compliance    Compliance

                  4    Repair    Repair

                  8    Inventory/Component Discovery    Inventory/Component Discovery

                  16    Snapshot    Snapshot

                  32    Audit    Audit

                  64    Auto-Remediate    Auto-Remediate

                  128    Package    Package

                  256    Deploy    Deploy