Project

General

Profile

Actions

Bug #14934

closed

Rudder directive API seem to take key-value order into account in json POST request

Added by Félix DALLIDET over 5 years ago. Updated about 4 years ago.

Status:
Released
Priority:
N/A
Category:
API
Target version:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Operational - other Techniques | Rudder settings | Plugins
Effort required:
Priority:
43
Name check:
Fix check:
Checked
Regression:

Description

On my rudder server in 5.0, I tried to import a given technique from its json, I ended up not being able to import it if some key-value were on the wrong order.
Which should not be the case since I guess it should only be key-value based.

I put 2 files here containing some User directive, one works, the other doesn't.


root@server:/tmp# diff not_working.json working.json 
25,26c25,26
<                                                 "value": "linux-shadow-sha256:$5$YNADkZ07$htb77c7EFCvMnMriWLRK.MWDWkQOuZ8ErNJxW.TAK2A",
<                                                 "name": "USERGROUP_USER_PASSWORD" 
---
>                                                 "name": "USERGROUP_USER_PASSWORD", 
>                                                 "value": "linux-shadow-sha256:$5$YNADkZ07$htb77c7EFCvMnMriWLRK.MWDWkQOuZ8ErNJxW.TAK2A" 

The curl command used:

curl --show-error --silent --insecure --location --proxy '' --globoff -H "X-API-Token: xxxxxx" -X PUT "https://127.0.0.1/rudder/api/latest/directives" -H "Content-Type: application/json" -d @/tmp/working.json | jq ''

The error message was absolutly not clear about the error:

{
  "action": "createDirective",
  "result": "error",
  "errorDetails": "Could not create Directive <- Could not extract values from request <- Missing required attribute 'name' for <section>: JObject(List(JField(var,JObject(List(JField(value,JString(linux-shadow-sha256:$5$YNADkZ07$htb77c7EFCvMnMriWLRK.MWDWkQOuZ8ErNJxW.TAK2A)), JField(name,JString(USERGROUP_USER_PASSWORD)))))))" 
}

This is a template, please edit and remove what is not relevant.

I found this bug in Rudder version [Your Version here], on [Distribution here]

This bug happens:

  • During installation of Rudder agent / Rudder server
  • While running rudder agent on a Node
  • When using Rudder web interface
  • When looking at compliance of a Node
  • When configurations are generated on Rudder Server
  • When a Nodes applies a configuration

Description:

You can reproduce it with the following steps:

  • ...
  • ...

You can workaround this issue by doing likewise:


Files

working.json (5.46 KB) working.json Félix DALLIDET, 2019-05-22 10:21
not_working.json (5.46 KB) not_working.json Félix DALLIDET, 2019-05-22 10:21

Related issues 1 (1 open0 closed)

Related to Rudder - Bug #18170: LDAP search error with directive creation API when no id is providedNewFrançois ARMANDActions
Actions

Also available in: Atom PDF