Skip to content

Allow config contexts to append to existing values #10916

@WhaleJ84

Description

@WhaleJ84

NetBox version

v3.3.7

Feature type

Change to existing functionality

Proposed functionality

I'm proposing some way for users to append to existing values in configuration contexts rather than just overwriting. An example of current and desired behavior is explained in the Use Case section below.

Use case

Currently, if I create two tags ["Service-HTTP", "Service-HTTPS"] with the intent of applying these tags to a device that has two services [{"name": "HTTP", "ports": [80]}, {"name": "HTTPS", "ports": [443]}], with the config-contexts:

[
    {
        "name": "Service-HTTP-config",
        "weight": 1000,
        "data": {
            {"ports:" [80]}
        }
    },
    {
        "name": "Service-HTTPS-config",
        "weight": 1000,
        "data": {
            {"ports:" [443]}
        }
    }
]

then the device's config-context would only render {"ports": [80]}. Likewise, changing with Service-HTTPS-config context weightings would overwrite the config and be {"ports": [443]}.

However, in this example, I want to dynamically render the planned open ports on the device so the firewall can be automatically configured from the context {"ports": [80, 443]}. I've looked at the documentation but did not notice a way to append to existing values - only overwrite.

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closureRequires immediate attention to avoid being closed for inactivitystatus: revisions neededThis issue requires additional information to be actionabletype: featureIntroduction of new functionality to the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions