Project

General

Profile

Actions

Bug #19867

closed

Block definition right after a variable definition break the compiler

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

Status:
Rejected
Priority:
N/A
Assignee:
-
Category:
rudderc
Target version:
Severity:
Minor - inconvenience | misleading | easy workaround
UX impact:
User visibility:
Operational - other Techniques | Rudder settings | Plugins
Effort required:
Priority:
14
Name check:
To do
Fix check:
To do
Regression:

Description

In a rudderlang technique, the following is correct:

CIS_rhel7_setup_filesystem state configured() {
  let bench = "CIS_RHEL7" 

  if any =>
    @index = "1.1.1.1" 
    @component = "Ensure mounting of cramfs filesystems is disabled" 
    {
      condition("${bench}_1_1_1_1").from_variable_existence("node.properties[${bench}][1.1.1.1]")
      if CIS_RHEL7_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 the same without newline after the variable definition does throw a syntax error:

CIS_rhel7_setup_filesystem state configured() {
  let bench = "CIS_RHEL7" 
  if any =>
    @index = "1.1.1.1" 
    @component = "Ensure mounting of cramfs filesystems is disabled" 
    {
      condition("${bench}_1_1_1_1").from_variable_existence("node.properties[${bench}][1.1.1.1]")
      if CIS_RHEL7_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", "")
      }
    }

And the error, which does fail on other part of the technique for no reasons:

An error occurred, could not create content from 'technique.rd':
'CIS_kernel_module': 'name' metadata is mandatory ; 'CIS_kernel_module': 'description' metadata is mandatory ; 'CIS_kernel_module': 'version' metadata is mandatory ; 'CIS_kernel_module': 'category' metadata is mandatory ; 'CIS_kernel_module': 'parameters' metadata is mandatory

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

The behaviour does not seem to be fully reproductible. If I recompile right after the error, it works... Could be a cache issue?

Actions

Also available in: Atom PDF