cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Who Me Too'd this topic

delete node from Python with service._path

Gastonper
Level 1
Level 1

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?

Who Me Too'd this topic