Project

General

Profile

Actions

Bug #19866

closed

Rudderlang must support dynamic built classes

Added by Félix DALLIDET almost 3 years ago. Updated about 2 years ago.

Status:
Rejected
Priority:
N/A
Assignee:
-
Category:
rudderc
Target version:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:

Description

When editing a technique, it is a common usecase to use a variable call in a "condition" field.
It does not seem to be possible to recreate such beahviour in rudderlang at the moment.

For instance, here I want to define a prefix from a string variable, which will be used in my condition field later.
This is possible from the technique editor, by defining a "variable from string", and them calling it in the condition field of the block parameter.

let bench = "CIS_RHEL7" 
condition("${bench}_1_1_1_1").from_variable_existence("node.properties[${bench}][1.1.1.1]")
if "${bench}_1_1_1_1_false" =>
{
    command("lsmod | grep -q cramfs").execution_result("1", "")
    command("modprobe -n -v cramfs | grep -qE 'install (/bin/true|/bin/false)'").execution_result("1", "")
}

But when compiling this in rudderlang, I have the following error:

An error occurred, could not create content from 'technique.rd':
technique.rd:37:7 near 'if "${bench}_1_1_1_1_false" =>'
!--> The following keyword was expected: 'enum expression'.

An error occurred, could not create content: Command was "/opt/rudder/bin/rudderc" "technique" "read" "-i" "technique.rd" 

In fact, the conditions inputs in rudderlang seem to only expect static class types of variable. And we are unable to build them dynamically from string manipulation.

Actions

Also available in: Atom PDF