Bug #8957
closedRudder Directive Rest API does not parse json parameters correctly
Description
I run pretty much this:
curl -s -k -X PUT -H "X-API-Token: zzzz" \
-H "Content-Type: application/json" \
"https://localhost/rudder/api/latest/directives" \
-d @${o}
The file in -d looks like this:
@ cat jsonthing
{
"id": "some_specific_uuid",
"displayName": "varname",
"shortDescription": "This in an example Directive to use in Rudder api documentation",
"longDescription": "",
"enabled": true,
"system": false,
"parameters": {
"section": {
"name": "sections",
"sections": [
{
"section": {
"name": "Variable definition",
"vars": [
{
"var": {
"name": "GENERIC_VARIABLE_CONTENT",
"value": "REPLACE_THIS_TO_TEST"
}
},
{
"var": {
"name": "GENERIC_VARIABLE_NAME",
"value": "var_meepmeep"
}
}
]
}
}
]
}
},
"techniqueName": "genericVariableDefinition"
}@
{"action": "createDirective","id": "dff2e53b-5cbe-4c74-a07f-95775e7cc804","result": "success","data": {"directives": [{"id": "dff2e53b-5cbe-4c74-a07f-95775e7cc804","displayName": "varname","shortDescription": "This in an example Directive to use in Rudder api documentation","longDescription": "","techniqueName": "genericVariableDefinition","techniqueVersion": "2.0","parameters": {"section": {"name": "sections","sections": [{"section": {"name": "Variable definition","vars": [{"var": {"name": "GENERIC_VARIABLE_CONTENT","value": "733f9f34d2cd421afd5ef85295f9c8d5"}},{"var": {"name": "GENERIC_VARIABLE_NAME","value": "var_meepmeep"}}]}}]}},"priority": 5,"isEnabled": true,"isSystem": false}]}}
The UUID returned from the directive creation is NOT the one I gave.
If I try to pass in the ID via another parameter I find that it gets worse.
I add: -d "id=myuuid" \
and it'll say:
{"action": "createDirective","id": "b162f3c1-a725-4468-a7e9-f1956b6d21e1","result": "error","errorDetails": "Could not get create a Directive details because there is no value as display name."}
So 1) it again doesn't read the id 2) it doesn't read anything else either.
Maybe my -d call here is wrong.
In any case, it seems there is absolutely no way to use this as documented.
Could you please look into it?
It blocks all my progress tbh.
Updated by Vincent MEMBRÉ about 8 years ago
- Status changed from New to In progress
- Assignee set to Vincent MEMBRÉ
Updated by Vincent MEMBRÉ about 8 years ago
Work in progess here: https://github.com/VinceMacBuche/rudder/commit/01f67520525115842d7650c9af51b76d0082bf9a
Updated by Vincent MEMBRÉ about 8 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/1192
Updated by François ARMAND about 8 years ago
- Status changed from Pending technical review to 12
- Assignee changed from François ARMAND to Vincent MEMBRÉ
Updated by Vincent MEMBRÉ about 8 years ago
- Status changed from 12 to Pending release
- % Done changed from 0 to 100
Applied in changeset rudder|b05a48ba0854f8c1f98039ab98f730dfac3e393c.
Updated by Vincent MEMBRÉ about 8 years ago
- Subject changed from Web API doesn't process uuid for newly added directive to Rudder Directive Rest API does not parse json parameters correctly
Updated by Vincent MEMBRÉ about 8 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 3.1.15/14 and 3.2.8/7 which were released today.
- 3.1: Announce Changelog
- 3.2: Announce Changelog
- Download: https://www.rudder-project.org/site/get-rudder/downloads/