Project

General

Profile

Actions

Bug #16684

closed

Bug #16667: Add authorized network configuration in settings api

Inconsistency between GET et POST attribute name for authorizedNetworks JSON API

Added by François ARMAND about 4 years ago. Updated about 4 years ago.

Status:
Released
Priority:
N/A
Assignee:
-
Category:
Architecture - Dependencies
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Reviewed
Fix check:
Checked
Regression:

Description

When testing authorized network API, I get for GET:

% curl -k -X GET -H "X-API-TOKEN: 976051bb-a539-4685-ab1c-a70182a1d89f-system" https://xxxx/rudder/api/latest/settings/authorizedNetworks/root | jq .
{
  "action": "getAuthorizedNetworks",
  "id": "root",
  "result": "success",
  "data": {
    "settings": [
      "192.168.52.0/24",
      "192.168.52.0/24" 
    ]
  }
}

So I tried to update with that POST, but it deleted everything:

% curl -k -X POST -H "Content-Type: application/json" -H "X-API-TOKEN: 976051bb-a539-4685-ab1c-a70182a1d89f-system" https://xxxx/rudder/api/latest/settings/authorizedNetworks/root -d '{"settings":["192.168.52.0/16"]}'  | jq .
{
  "action": "modifyAuthorizedNetworks",
  "id": "root",
  "result": "success",
  "data": {
    "settings": []
  }
}

The actual JSON is:

% curl -k -X POST -H "Content-Type: application/json" -H "X-API-TOKEN: 976051bb-a539-4685-ab1c-a70182a1d89f-system" https://xxxx/rudder/api/latest/settings/authorizedNetworks/root -d '{"authorizedNetworks":["192.168.52.0/24"]}'  | jq .
{
  "action": "modifyAuthorizedNetworks",
  "id": "root",
  "result": "success",
  "data": {
    "settings": [
      "192.168.52.0/24" 
    ]
  }
}

Two things here:

- in the "data" part, the name should be authorizedNetworks and not settings,
- if the authorizedNetworks key is missing in POSTed JSON, we should do nothing.

Finally, for consistancy with other settings, I believe we should use settings/authorized_networks/


Subtasks 1 (0 open1 closed)

Bug #16688: Changes to extractList break plugin APIReleasedFrançois ARMANDActions
Actions #1

Updated by François ARMAND about 4 years ago

  • Description updated (diff)
Actions #2

Updated by Vincent MEMBRÉ about 4 years ago

  • Status changed from New to In progress
Actions #3

Updated by Vincent MEMBRÉ about 4 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Vincent MEMBRÉ to François ARMAND
  • Pull Request set to https://github.com/Normation/rudder/pull/2759
Actions #4

Updated by Vincent MEMBRÉ about 4 years ago

  • Status changed from Pending technical review to Pending release
Actions #5

Updated by François ARMAND about 4 years ago

  • Category changed from API to Architecture - Dependencies
  • Assignee deleted (François ARMAND)
  • Target version deleted (5.0.16)
  • Name check deleted (To do)
  • Fix check changed from To do to Checked
Actions #6

Updated by Vincent MEMBRÉ about 4 years ago

  • Target version set to 5.0.16
Actions #7

Updated by Alexis Mousset about 4 years ago

  • Name check set to Reviewed
Actions #8

Updated by Vincent MEMBRÉ about 4 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 5.0.16 which was released today.

Actions

Also available in: Atom PDF