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

Unable to assign config context to device redundancy group using the REST API #4649

Closed
nrnvgh opened this issue Oct 13, 2023 · 4 comments
Closed
Labels
type: bug Something isn't working as expected

Comments

@nrnvgh
Copy link
Contributor

nrnvgh commented Oct 13, 2023

Environment

  • Nautobot version (Docker tag too if applicable): 1.6.3
  • Python version: 3.11.6
  • Database platform, version: MySQL 8.1
  • Middleware(s): pynautobot, browser-based REST API

Steps to Reproduce

  1. Using the API, create two device redundancy groups
  2. Using the API, create a two devices with the same role, one in each of the device redundancy groups
  3. Using the API, create a config context for each device redundancy group with some unique information for the data attribute; something like:
{
  "name": "context-1",
  "roles": [ROLE_UUID],
  "device_redundancy_groups": [DEVICE_REDUNDANCY_GROUP_UUID],
  "data": {
    "id": 1001
  }

Note also that there's no device_redundancy_groups field visible in the browser REST API interface under `POST

Expected Behavior

Each device should inherit one drg-based config context.

Observed Behavior

Each devices inherits both config contexts, despite the devices being in different device redundancy groups, e.g.:

Screenshot 2023-10-13 at 3 55 49 PM

Possible patch

I've put together the attached patch which works for me, but as I'm almost entirely unfamiliar with the nautobot code base I'm not entirely certain if it's how you'd want to fix it (or if it's complete/correct). Happy to submit a PR if you'd like.

config_context_redundancy_group_api.patch

@nrnvgh nrnvgh added triage This issue is new and has not been reviewed. type: bug Something isn't working as expected labels Oct 13, 2023
@glennmatthews
Copy link
Contributor

Looks like you've correctly identified the issue and the proposed fix looks like a solid starting point to me. Would like to have the final code include some test coverage for this issue, but if you'd like to open a PR with your patch we can run with it from there. Thank you!

@glennmatthews
Copy link
Contributor

As a note, this should be a v1.6-exclusive issue due to changes in how serializers work in v2.0; I'll find some time to test with 2.0 and confirm that this is the case. You should be fine to open your PR against the ltm/1.6 branch.

@glennmatthews glennmatthews removed the triage This issue is new and has not been reviewed. label Oct 16, 2023
glennmatthews added a commit that referenced this issue Oct 20, 2023
* initial cut of fix for #4649

* Added test case and changelogs

---------

Co-authored-by: Timizuo <ebideritimizuo@gmail.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
@nrnvgh
Copy link
Contributor Author

nrnvgh commented Oct 20, 2023

Thanks for being so responsive on this; it's greatly appreciated. Just so I know what to tell our local admins: Do you know about when code including this update will be tagged for release?

@glennmatthews
Copy link
Contributor

Within a month most likely; possibly sooner than that, but I think we've identified a couple of other items to backport to 1.6 before we cut a new release. Thanks for the fixes!

@nrnvgh nrnvgh closed this as completed Dec 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants