Project

General

Profile

Bug #8957

Rudder Directive Rest API does not parse json parameters correctly

Added by Florian Heigl over 3 years ago. Updated over 3 years ago.

Status:
Released
Priority:
1
Category:
API
Target version:
Severity:
User visibility:
Effort required:
Priority:

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.


Subtasks

Bug #9194: Two level of 'directives' in directive APIReleasedFrançois ARMANDActions

Associated revisions

Revision b05a48ba (diff)
Added by Vincent MEMBRÉ over 3 years ago

Fixes #8957: Web API doesn't process uuid for newly added directive

Revision 53f75d9c (diff)
Added by Vincent MEMBRÉ over 3 years ago

Fixes #8957: Web API doesn't process uuid for newly added directive

History

#1

Updated by Vincent MEMBRÉ over 3 years ago

  • Status changed from New to In progress
  • Assignee set to Vincent MEMBRÉ
#3

Updated by Vincent MEMBRÉ over 3 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
#4

Updated by François ARMAND over 3 years ago

  • Status changed from Pending technical review to 12
  • Assignee changed from François ARMAND to Vincent MEMBRÉ
#5

Updated by Vincent MEMBRÉ over 3 years ago

  • Status changed from 12 to Pending release
  • % Done changed from 0 to 100
#6

Updated by Vincent MEMBRÉ over 3 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
#7

Updated by Vincent MEMBRÉ over 3 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.

Also available in: Atom PDF