Project

General

Profile

Actions

Bug #10225

closed

Fix behavior of directive API and make api more consistent

Added by Dmitry Svyatogorov about 7 years ago. Updated almost 7 years ago.

Status:
Released
Priority:
1
Category:
API
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Fix check:
Regression:

Description

The following json passes ok to 4.0.2, but in latest 4.1.0 beta 3 it fails with HTTPError = 500
"Could not create Group e9d994a4-1bc3-4069-8d67-4aa329a3bbe6 cause is: Missing expected 'select' query parameter."

{
  "category": "GroupRoot",
  "displayName": "#TEST#",
  "description": "New directives must be tested against members of this group.",
  "enabled": true,
  "dynamic": false,
  "query": {
    "where": [
      {
        "attribute": "nodeHostname",
        "value": "xxx-test.tld",
        "comparator": "eq",
        "objectType": "node" 
      }
    ],
    "composition": "Or",
    "select": "node" 
  }
}

Actions #1

Updated by Dmitry Svyatogorov about 7 years ago

  • * API "Create a new Directive" is broken as well. Just create some directive in current beta, then try to get/put it. Server answers with plain text "Could not extract values from request."
    Example json to PUT:
    {"policyMode": "default", "displayName": "/test", "parameters": {"section": {"sections": [{"section": {"sections": [{"section": {"name": "Enforce content by section", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_SECTION_MANAGEMENT", "value": "false"}}, {"var": {"name": "GENERIC_FILE_SECTION_CONTENT", "value": ""}}, {"var": {"name": "GENERIC_FILE_SECTION_FOOTER", "value": ""}}, {"var": {"name": "GENERIC_FILE_SECTION_HEADER", "value": ""}}]}}, {"section": {"name": "Enforce content only in zone", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_MIGRATE_TO_ZONE_BOOLEAN", "value": "false"}}, {"var": {"name": "GENERIC_FILE_CONTENT_ZONE_FOOTER", "value": "### End of section managed by Rudder"}}, {"var": {"name": "GENERIC_FILE_CONTENT_ZONE_HEADER", "value": "### Beginning of section managed by Rudder"}}]}}, {"section": {"name": "File", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_CREATE_BOOLEAN", "value": "true"}}, {"var": {"name": "GENERIC_FILE_CONTENT_DELETION_BOOLEAN", "value": "false"}}, {"var": {"name": "GENERIC_FILE_CONTENT_ENFORCE", "value": "true"}}, {"var": {"name": "GENERIC_FILE_CONTENT_ENFORCE_CREATE_ONLY_BOOLEAN", "value": "false"}}, {"var": {"name": "GENERIC_FILE_CONTENT_MODIFICATION_BOOLEAN", "value": "false"}}, {"var": {"name": "GENERIC_FILE_CONTENT_ONLY_ZONE_BOOLEAN", "value": "false"}}, {"var": {"name": "GENERIC_FILE_CONTENT_PATH", "value": "/test"}}]}}, {"section": {"name": "File content", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_PAYLOAD", "value": "test"}}]}}, {"section": {"name": "Line deletion regular expressions", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_DELETION_REGEXP", "value": "deleteme.*"}}]}}, {"section": {"name": "Line replacement regular expressions", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_MODIFICATION_DESTINATION", "value": ""}}, {"var": {"name": "GENERIC_FILE_CONTENT_MODIFICATION_REGEXP", "value": "replaceme.*"}}]}}, {"section": {"name": "Permission adjustment", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_GROUP", "value": "root"}}, {"var": {"name": "GENERIC_FILE_CONTENT_OWNER", "value": "root"}}, {"var": {"name": "GENERIC_FILE_CONTENT_PERM", "value": "644"}}, {"var": {"name": "GENERIC_FILE_CONTENT_PERMISSION_ADJUSTMENT", "value": "true"}}]}}, {"section": {"name": "Post-modification hook", "vars": [{"var": {"name": "GENERIC_FILE_CONTENT_POST_HOOK_COMMAND", "value": ""}}, {"var": {"name": "GENERIC_FILE_CONTENT_POST_HOOK_RUN", "value": "false"}}]}}], "name": "File to manage"}}], "name": "sections"}}, "tags": [{"a": "b"}], "enabled": true, "system": false, "longDescription": "", "priority": 5, "techniqueName": "checkGenericFileContent", "shortDescription": "", "id": "ae1af95a-62ed-44be-983d-eacf42a12f9d"}
    
Actions #2

Updated by Vincent MEMBRÉ about 7 years ago

  • Priority changed from N/A to 1

Hello Dmitry !

Thank you for reporting this. We haven't changed anything but we changed some of our dependencies (especially one manipulating json / rest api ) maybe a behavior changed

I'll fix it asap

Actions #3

Updated by Vincent MEMBRÉ about 7 years ago

May be some code to extract data changed too

Actions #4

Updated by Vincent MEMBRÉ about 7 years ago

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

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 4.1.0~rc1 to 3.1.19
Actions #6

Updated by Vincent MEMBRÉ about 7 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/1523
Actions #7

Updated by Vincent MEMBRÉ about 7 years ago

  • Subject changed from API "Create a new Group" is broken in Rudder 4.1.0 beta 3 to Fix behavior of directive API and make api more consistent
  • Status changed from Pending technical review to In progress
  • Assignee changed from François ARMAND to Vincent MEMBRÉ
  • Pull Request deleted (https://github.com/Normation/rudder/pull/1523)

After some inquiry, I found two issues:

  • The library we use to parse json has changed a behavior, breaking both Directives and Groups Rest API, changing the function used fix the issue
  • "displayName" is not parsed correctly and is ignored a workaround is to use "name" instead, but we need to fix the parsing of "displayName"

Backporting the fix to 3.1

Actions #8

Updated by Vincent MEMBRÉ about 7 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/1523
Actions #9

Updated by Benoît PECCATTE about 7 years ago

  • Found in version (s) 4.1.0~beta2 added
Actions #10

Updated by Benoît PECCATTE about 7 years ago

  • Found in version(s) old deleted (4.1.0.beta2)
Actions #11

Updated by Vincent MEMBRÉ about 7 years ago

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

Updated by Vincent MEMBRÉ almost 7 years ago

  • Status changed from Pending release to Released
  • Priority set to 0

This bug has been fixed in Rudder 3.1.19, 4.0.4 and 4.1.1 which were released today.

Actions

Also available in: Atom PDF