Skip to content

bug: SDK Tracking feature errors out when handling parent/component deletion sequence #265

@FragmentedPacket

Description

@FragmentedPacket

Component

No response

Infrahub SDK version

1.1.6

Current Behavior

If the parent and all the components of the relationship are being deleted due to the difference in the generator, it fails with: ['NetworkPhysicalInterfaceL3Delete'] Unable to find the node 1821cc90-7fb1-f8b3-3b21-c51f9599f512 / NetworkPhysicalInterfaceL3 in the database.

This example is all interfaces (component) to a device (parent) are being deleted as well as the parent object.

Expected Behavior

It would just delete the parent node rather than all the component objects tied to the node to prevent it attempting to delete a component when the parent has been deleted and the deletion is cascading down.

Steps to Reproduce

  1. Spin up infrahub
  2. Load base and extensions/location_minimal from https://github.com/opsmill/schema-library
  3. Create a generator that will build a site, 2 devices, and 24 interfaces for each device (ranges would work to keep generator simple)
  4. Run the generator and let it create the devices and interfaces
  5. Modify the generator to only generate one of those devices
  6. Execute generator and it should show an error that it fails to delete one of the interfaces due to it no longer existing

Additional Information

While researching this further, I believe this code may need to account for parent/component relationships when processing previous children.

https://github.com/opsmill/infrahub-sdk-python/blob/stable/infrahub_sdk/query_groups.py#L102-L111

Metadata

Metadata

Assignees

Labels

priority/2This issue stalls work on the project or its dependents, it's a blocker for a releasetype/bugSomething isn't working as expected

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions