Project

General

Profile

Actions

Bug #24226

closed

rudderc canonifies already canonified condition expression resulting in loss of logic operators such as ) and |

Added by Félix DALLIDET 3 months ago. Updated 2 months ago.

Status:
Released
Priority:
N/A
Category:
rudderc
Target version:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
I hate Rudder for that
User visibility:
First impressions of Rudder
Effort required:
Small
Priority:
196
Name check:
To do
Fix check:
Checked
Regression:
No

Description

See the following yaml as example:

id: os_condition_logic_or_
name: 'OS condition logic OR '
version: '1.0'
category: ncf_techniques
items:
  - id: 74537fd1-bbb7-460e-bf2c-dcfc341c2fe0
    name: logic with or
    condition: ubuntu_22_04|centos_8
    method: file_present
    params:
      path: /tmp/os-condition-or
  - id: 8421d610-ebc6-4a2f-b3de-f04fb101e944
    name: for ubuntu 22.04.03
    condition: ubuntu_22_04
    method: file_present
    params:
      path: /tmp/os-condition-only-ubuntu22
  - id: b63fc018-b2d8-4f4b-8535-b4143e760779
    name: for centos 8
    condition: centos_8
    method: file_present
    params:
      path: /tmp/os-condition-only-centos8

The first section will never be executed as the generated cfengine code is the following:

bundle agent call_os_condition_logic_or__74537fd1_bbb7_460e_bf2c_dcfc341c2fe0(c_name, c_key, report_id, args, class_prefix, method_call_condition, path) {
  methods:
    "74537fd1-bbb7-460e-bf2c-dcfc341c2fe0_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}");
    "74537fd1-bbb7-460e-bf2c-dcfc341c2fe0_${report_data.directive_id}" usebundle => file_present("${path}"),
                                             if => canonify("${method_call_condition}");

Where `method_call_condition` is `"ubuntu_22_04|centos_8"` which must NOT be canonified again.


Files

os_condition_logic_validation.yml (880 Bytes) os_condition_logic_validation.yml Elaad FURREEDAN, 2024-02-28 11:07

Related issues 1 (0 open1 closed)

Related to Rudder - Bug #24291: Add integration tests to ruddercReleasedFélix DALLIDETActions
Actions #1

Updated by Félix DALLIDET 3 months ago

  • Status changed from New to In progress
  • Assignee set to Félix DALLIDET
Actions #2

Updated by Félix DALLIDET 3 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Félix DALLIDET to Vincent MEMBRÉ
  • Pull Request set to https://github.com/Normation/rudder/pull/5407
Actions #4

Updated by Elaad FURREEDAN 3 months ago

  • Severity set to Major - prevents use of part of Rudder | no simple workaround
  • Priority changed from 0 to 196
Actions #5

Updated by Félix DALLIDET 3 months ago

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

Updated by Félix DALLIDET 2 months ago

  • Fix check changed from To do to Checked
Actions #7

Updated by Elaad FURREEDAN 2 months ago

I use this technique (See attachment) to validate the method, I have one server on Debian 12 and an agent on Ubuntu 22.04

On the server (Debian 12) :

root@server:/tmp# ls -l
total 28
-rw------- 1 root root    0 Feb 28 10:06 os-condition-and-deb12
-rw------- 1 root root    0 Feb 28 10:05 os-condition-only-debian12
-rw------- 1 root root    0 Feb 28 10:05 os-condition-or
...

On the node (Ubuntu 22):
root@ubuntu:/tmp# ls -l
total 24
-rw------- 1 root    root       0 Feb 28 10:04 os-condition-only-ubuntu22
-rw------- 1 root    root       0 Feb 28 10:04 os-condition-or
...

Actions #8

Updated by Elaad FURREEDAN 2 months ago

  • Fix check changed from To do to Checked
Actions #9

Updated by Vincent MEMBRÉ 2 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 8.0.6 which was released today.

Actions #10

Updated by Alexis Mousset 2 months ago

  • Related to Bug #24291: Add integration tests to rudderc added
Actions

Also available in: Atom PDF