Add possibility to force delete some non-trivial objects by jython script

Idea ID 1652547

Add possibility to force delete some non-trivial objects by jython script

Hi

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)

 

Exmple code:

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)
framework.deleteObjects(oshv)
# 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:

 

 framework.deleteObjects(oshvToDelete, oshvToIdentification) 

where oshvToDelete is subset of oshvToIdentification.

 

Tags (2)
2 Comments
Micro Focus Contributor
Micro Focus Contributor

This seems more like a bug. Did you open a support ticket about it?

Micro Focus Contributor
Micro Focus Contributor
Status changed to: Declined

Pease open a ticket with support

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.