Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Delete a host object

Overview

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.

Description

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.

Instructions

run delete_host.py (python 2.7 code).

Code Version

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

...

0 Kudos
1 Reply
Highlighted
Explorer

Does this script actually work on R80.20? Specifically on MDS? I sort of got it to work on SC but never on MDS. I can never match the fingerprint. api fingerprint value never matches what the server returns. I eventually gave up and wrote a bash hack to do the same but I'd actually like to use python and the web api instead of mgmt_cli
0 Kudos