Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Job Result Log Entry for Nested Objects in Nautobot Design Builder #206

Open
ndmitri opened this issue Jan 16, 2025 · 1 comment
Labels
status: accepted This issue has been accepted by the maintainers team for implementation

Comments

@ndmitri
Copy link

ndmitri commented Jan 16, 2025

Environment

  • Python version: 3.10.12
  • Nautobot version: 2.1.4
  • nautobot-design-builder version: 2.1.0

Expected Behavior

When a nested object is created within another object in a design template, the Job Result Log should record the creation of both objects.

For example, in the following design template:

locations:
  - name: "{{ site_name }}"
    location_type__name: "Site"
    parent__name: "{{ region.name }}"
    status__name: "Active"
    prefixes:
      - prefix: "{{ site_mgmt_prefix }}"
        type: "container"
        role__name: "SNI::MGMT"
        status__name: "Active"

Both the Location and the Prefix are created successfully, and the relationship between them is established.
However, the Job Result Log only logs the creation of the Location, while the creation of the Prefix is missing.


Observed Behavior

When an object is nested inside another object in a design template (such as a Prefix inside a Location), the creation of the nested object is not logged in the Job Result Log.

However, when the relationship is explicitly defined using !ref, both objects are logged correctly:

locations:
  - name: "{{ site_name }}"
    location_type__name: "Site"
    parent__name: "{{ region.name }}"
    status__name: "Active"
    "!ref": "site"

prefixes:
  - prefix: "{{ site_mgmt_prefix }}"
    type: "container"
    role__name: "SNI::MGMT"
    status__name: "Active"
    location: "!ref:site"

In this case, both Created Location {{ site_name }} and Created Prefix {{ site_mgmt_prefix }} appear in the Job Result Log as expected.


Steps to Reproduce

  1. Create a design template where one object is nested inside another object.
  2. Run the Design Builder job to implement the design.
  3. Check the Job Result Log and observe that only the top-level object is logged, while the nested object is missing from the log.
  4. Modify the template to explicitly define the relationship using !ref.
  5. Run the job again and observe that now both objects are logged correctly.

Proposed Fix

Ensure that all nested objects are logged in the Job Result Log, just as they are when explicitly referenced with !ref.

@chadell
Copy link
Contributor

chadell commented Jan 24, 2025

You are correct @ndmitri

@chadell chadell added the status: accepted This issue has been accepted by the maintainers team for implementation label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted This issue has been accepted by the maintainers team for implementation
Projects
None yet
Development

No branches or pull requests

2 participants