Idea ID 1652547
In jython scripts used either by UD or integrations you can force delete of some CIs by using code similar to:
oshv = ObjectStateHolderVector() # here add objects to oshv framework.deleteObjects(oshv)
However using this code, it is not possible to delete for example MS SQL Instance which is running on Cluster Resource Group. Topology is:
Cluster -- containment--> Cluster Resource Group -- composition--> SQL (Running Software)
clusterOsh = ObjectStateHolder('mscluster') clusterOsh.setAttribute('name', 'test-cluster') clusterResGrpOsh = ObjectStateHolder('cluster_resource_group') clusterResGrpOsh.setAttribute('name', 'test-resource-group01') containmentLinkOsh = modeling.createLinkOSH('containment', clusterOsh, clusterResGrpOsh) sqlOsh = ObjectStateHolder('sqlserver') sqlOsh.setAttribute('name', 'test-sql-instance') sqlOsh.setAttribute('discovered_product_name', 'sqlserver') sqlOsh.setContainer(clusterResGrpOsh) oshvToDel = ObjectStateHolderVector() oshvToDel.add(sqlOsh)
# The above will fail, since it's not possible to add clusterOsh to oshv
# which is required for identification
When you add SQL DB to oshv for deletion, framework automatically adds parent objects connected by composition. In this case it stops at Cluster Resource Group - however CRG needs cluster for identification. Sending such object to delete casues error in server reconciliation log with message regarding not enough reconciliation data to identify cluster resource group.
As a workaround we set some specific value (example: "deleted") in selected attribute (like description) and use enrichment to delete such objects. However this adds necessity to use enrichments instead of pure jython code.
There should be function similar to:
where oshvToDelete is subset of oshvToIdentification.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.