cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
301
Views
0
Helpful
2
Replies
Highlighted
Beginner

delete node from Python with service._path

Hi, I have the following problem:

 

I have a services (service A) that when is created populate his path in another service (Service B). Service B have multiple path of instances of service A.

I want to make an action that read all service path in Service B, and delete the corresponding services A.

 

Here is the problem, to get the service object in Python from the path string I use:

service_to_delete = ncs.maagic.get_node(t, service_path)
del service_to_delete

But this only delete the Python object service_to_delete, and not the CDB service, as is explained in the nso docs.

If I use:

del ncs.maagic.get_node(t, service_path)

I get an error on package reload:

*** ALARM package-load-failure: [SyntaxError: can't delete function call]

Is there a delete_node() function or a workaround to solve this?

2 REPLIES 2
Highlighted
Cisco Employee

WIth the first option, are you applying the transaction in which you use 'del service_to_delete'?

Highlighted

Yes I do, but as I say its only delete the Python pointer object and not the node in the CDB.