Forum Discussion
Jan 26, 2021
Hello Thiyagu.
You are assigning 'member.name' to pool_memeber.
After that you are deleting this object, but this no makes sense.
First you need to load the whole pool object using "load" and then you can delete it.
# Delete a pool if it exists
if mgmt.tm.ltm.pools.pool.exists(name='mypool', partition='Common'):
pool_b = mgmt.tm.ltm.pools.pool.load(name='mypool', partition='Common')
pool_b.delete()
The pool object you are loading in the previous code is the same object you can get from your code this way.
for pool in ltm.pools.get_collection():
for member in pool.members_s.get_collection():
if my_node in member.name:
print("{} is in the pool {}".format(my_node, pool.name))
# Deleting the pool.
pool.delete()
Regards,
Darío.