Actions
Bug #16684
closedBug #16667: Add authorized network configuration in settings api
Inconsistency between GET et POST attribute name for authorizedNetworks JSON API
Pull Request:
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/
Updated by Vincent MEMBRÉ almost 5 years ago
- Status changed from New to In progress
Updated by Vincent MEMBRÉ almost 5 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
Updated by Vincent MEMBRÉ almost 5 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|ecb42f17a21d94f33e39a16c983d56c671a32a6c.
Updated by François ARMAND almost 5 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
Updated by Vincent MEMBRÉ almost 5 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 5.0.16 which was released today.
Actions