Project

General

Profile

Actions

Bug #20182

closed

Incorrect generation for DSC techniques

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

Status:
Rejected
Priority:
N/A
Assignee:
-
Category:
Web - Technique editor
Target version:
Severity:
Critical - prevents main use of Rudder | no workaround | data loss | security
UX impact:
User visibility:
Infrequent - complex configurations | third party integrations
Effort required:
Priority:
65
Name check:
To do
Fix check:
To do
Regression:

Description

In the latest debian10 nightly, I was not able to generate properly a dsc compatible technique using blocks.
With the technique attached, I ended up with:

# generated by rudderc
# @name push abcd.efg
# @version 1.0

function Push-Abcd-Efg {
  [CmdletBinding()]
  param (
    [Parameter(Mandatory=$True)]
    [String]$ReportId,
    [Parameter(Mandatory=$True)]
    [String]$TechniqueName,
    [Parameter(Mandatory=$True)]
    [String]$Abcd,
    [Switch]$AuditOnly
  )

  $LocalClasses = New-ClassContext
  $ResourcesDir = $PSScriptRoot + "\resources" 
  _rudder_common_report_na -ComponentName "File content" -ComponentKey "C:\\abcd.efg" -Message "Not applicable" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly
  _rudder_common_report_na -ComponentName "File content" -ComponentKey "/tmp/abcd.efg" -Message "Not applicable" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly
}

The very strange part is that when importing the technique.json exported from the technique editor, it seems to work as intended and I end up with:

# generated by rudderc
# @name the copy of the technique
# @version 1.0

function The-Copy-Of-The-Technique {
  [CmdletBinding()]
  param (
    [Parameter(Mandatory=$True)]
    [String]$ReportId,
    [Parameter(Mandatory=$True)]
    [String]$TechniqueName,
    [Parameter(Mandatory=$True)]
    [String]$Abcd,
    [Switch]$AuditOnly
  )

  $LocalClasses = New-ClassContext
  $ResourcesDir = $PSScriptRoot + "\resources" 
  $Class = "!linux" 
  if (Evaluate-Class $Class $LocalClasses $SystemClasses) {
    $LocalClasses = Merge-ClassContext $LocalClasses $(File-Content -Path "C:\\abcd.efg" -Lines "oui
    bonjour windows" -Enforce "true" -ComponentName "File content" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly).get_item("classes")
  }
  else {
    _rudder_common_report_na -ComponentName "File content" -ComponentKey "C:\\abcd.efg" -Message "Not applicable" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly
  }
  $Class = "linux" 
  if (Evaluate-Class $Class $LocalClasses $SystemClasses) {
    $LocalClasses = Merge-ClassContext $LocalClasses $(File-Content -Path "/tmp/abcd.efg" -Lines "oui
    bonjour linux" -Enforce "true" -ComponentName "File content" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly).get_item("classes")
  }
  else {
    _rudder_common_report_na -ComponentName "File content" -ComponentKey "/tmp/abcd.efg" -Message "Not applicable" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly
  }
}

This is a very disturbing behaviour, and happens silently.


Files

push_abcd_efg.json (2.04 KB) push_abcd_efg.json Félix DALLIDET, 2021-10-21 11:53
Actions

Also available in: Atom PDF