BSA: How can I use the blcli to delete a object like a Job or Depot Object ?

Version 4
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    BladeLogic Application Automation Suite


    COMPONENT:

    BladeLogic Application Server



    QUESTION:

    How can I use the blcli to delete a object like a Job or Depot Object ?


    ANSWER:

    Most of the Object Namespaces (Job, DepotObject, Template, etc) have a deletion command: <JobType> deleteJobByGroupAndName or Template deleteTemplate.  For example: DeployJob deleteJobByGroupAndName.  Check the blcli documentation first to see if there is already a delete command available.

    If the namespace for the object type does not have a delete command you can use the following sequence of commands to delete the job:

    get the object type id of the job using the model type string of the job.

    blcli_execute Utility convertModelType <model type string>
      
    or look up the object type id in the   Object Type Id table

    get the DBKey of the object:  
    blcli_execute <object namepace> getDBKeyByGroupAndName "/Workspace" "MyThing" blcli_storeenv objKey
      
    call the delete command using the DBKey and the Object Type Id you retrieved from either the blcli call or the documentation page.  
    blcli_execute Delete deleteModelObjectAndDependentObjects ${typeId} ${objKey}
      
    For example, I have an UpgradeModelObjects Job at   /Workspace/MyJobs/MyUMOJob that I want to delete: 
       
    blcli_execute UpgradeModelObjectsJob getDBKeyByGroupAndName "/Workspace/MyJobs" "MyUMOJob" blcli_storeenv jobKey blcli_execute Utility convertModelType POLICY_UPGRADE_JOB blcli_storeenv typeId blcli_execute Delete deleteModelObjectAndDependentObjects ${typeId} ${jobKey}
      


      

     


    Article Number:

    000157784


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles