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

PUT /api/3.0/federations only respects first item in request payload #6104

Closed
mitchell852 opened this issue Aug 13, 2021 · 0 comments · Fixed by #6109
Closed

PUT /api/3.0/federations only respects first item in request payload #6104

mitchell852 opened this issue Aug 13, 2021 · 0 comments · Fixed by #6109
Assignees
Labels
bug something isn't working as intended high impact impacts the basic function, deployment, or operation of a CDN Traffic Ops related to Traffic Ops
Milestone

Comments

@mitchell852
Copy link
Member

mitchell852 commented Aug 13, 2021

This Bug Report affects these Traffic Control components:

  • Traffic Ops

Current behavior:

A request to PUT /api/3.0/federations with a request body like:

[
  {
    "deliveryService":"demo1",
    "mappings":
    {
      "resolve4": ["1.2.3.4"],
      "resolve6": ["2001:db8:3333:4444:5555:6666:7777:8888"]
    }
  },
  {
    "deliveryService":"demo2",
    "mappings":
    {
      "resolve4": ["8.8.8.8"],
      "resolve6": ["2001:db8:3333:4444:5555:6666:7777:9999"]
    }
  }
]

will wipe out ALL "Federation to federation resolver mappings" associated with a user’s Delivery Service(s) and replace them with only the first one in the request payload. So if you have 100 mappings and try to add one, you will end up with 1 (instead of 101)

Expected behavior:

the "Federation to federation resolver mappings" associated with a user’s Delivery Service(s) should be replaced with ALL entries sent in the request payload. not just the first obviously.

Steps to reproduce:

POST /api/3.0/federations with

[
  {
    "deliveryService":"demo1",
    "mappings":
    {
      "resolve4": ["1.2.3.4"],
      "resolve6": ["2001:db8:3333:4444:5555:6666:7777:8888"]
    }
  },
  {
    "deliveryService":"demo2",
    "mappings":
    {
      "resolve4": ["8.8.8.8"],
      "resolve6": ["2001:db8:3333:4444:5555:6666:7777:9999"]
    }
  }
]

to create 2 federation mappings for your user. verify that 2 were created by calling GET /api/3.0/federations/all. Now try the PUT /api/3.0/federations endpoint with the same payload as the POST. verify that only 1 mapping exists by calling GET /api/3.0/federations/all.

Side note: what is the difference between the POST and PUT /api/3.0/federations (besides one apparently has a bug and the other does not)

@mitchell852 mitchell852 added bug something isn't working as intended Traffic Ops related to Traffic Ops high impact impacts the basic function, deployment, or operation of a CDN labels Aug 13, 2021
@mitchell852 mitchell852 added this to the 6.1.0 milestone Aug 13, 2021
@rawlinp rawlinp self-assigned this Aug 13, 2021
@rawlinp rawlinp modified the milestones: 6.1.0, 6.0.0 Aug 13, 2021
rawlinp added a commit to rawlinp/trafficcontrol that referenced this issue Aug 16, 2021
Instead of allowing the query to return no row on conflict, ensure it
always returns a row so that we can associate the resolver ID to the
federation.

Closes: apache#6104
zrhoffman pushed a commit that referenced this issue Aug 17, 2021
Instead of allowing the query to return no row on conflict, ensure it
always returns a row so that we can associate the resolver ID to the
federation.

Closes: #6104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working as intended high impact impacts the basic function, deployment, or operation of a CDN Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants