The purpose of this code it to show delete a host object while taking into consideration questions like: is the object a member of an existing group, is the object participating in a rulebase.
If the host object is not a member of a group and is not used in a rule-base - delete the host object.
If the host is being used in a rulebase - remove the host from the rulebase.
If the host object was the last object-in its cell - disable thr rule.
if the host object was a member of a group - remove it from the group.
If the group is now an empty group - delete the group.
If the deleted group appeared in a rulebase - remove it from the rulebase.
if the deleted group was the last object in the cell - disable the rule.
run delete_host.py (python 2.7 code).
Code version 1.0.0
Tested on version
R80, API version 1.0
NOTICE: By using this sample code you agree to terms and conditions in this Terms and Conditions