Project

General

Profile

Actions

Bug #20083

closed

DSC policies are generated without the conditions

Added by Félix DALLIDET 9 months ago. Updated 8 months ago.

Status:
Released
Priority:
N/A
Category:
rudderc
Target version:
Severity:
Critical - prevents main use of Rudder | no workaround | data loss | security
UX impact:
User visibility:
First impressions of Rudder
Effort required:
Priority:
124

Description

See the tehcnique attached and its generated ps1 file:

function Dsc-Block-Test {
  [CmdletBinding()]
  param (
      [parameter(Mandatory=$true)]
      [string]$reportId,
      [parameter(Mandatory=$true)]
      [string]$techniqueName,
      [switch]$auditOnly
  )

  $local_classes = New-ClassContext
  $resources_dir = $PSScriptRoot + "\resources" 

  $class = "" 
  if (Evaluate-Class $class $local_classes $system_classes) {
    $local_classes = Merge-ClassContext $local_classes $(Service-Started -Name "sshd" -componentName "Service started" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly)
.get_item("classes")
  } else {
    _rudder_common_report_na -componentName "Service started" -componentKey "sshd" -message "Not applicable" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly
  }

  $class = "" 
  if (Evaluate-Class $class $local_classes $system_classes) {
    $local_classes = Merge-ClassContext $local_classes $(Command-Execution -Command "write-output `"bob`"" -componentName "Command execution" -reportId $reportId -techniqueName $techniqueName
 -auditOnly:$auditOnly).get_item("classes")
  } else {
    _rudder_common_report_na -componentName "Command execution" -componentKey "write-output `"bob`"" -message "Not applicable" -reportId $reportId -techniqueName $techniqueName -auditOnly:$au
ditOnly
  }

}


Files

dsc_block_test.json (1.26 KB) dsc_block_test.json Félix DALLIDET, 2021-10-07 14:56

Subtasks 2 (0 open2 closed)

Bug #20109: String terminated by a double quote are not properly handles by ruddercReleasedAlexis MoussetActions
Bug #20110: rudderc translates kept into successReleasedAlexis MoussetActions
Actions #1

Updated by Benoît PECCATTE 8 months ago

After sub issue fixes, the output seems to be OK :

# generated by rudderc
# @name dsc block test
# @version 1.0

function Dsc-Block-Test {
  [CmdletBinding()]
  param (
    [Parameter(Mandatory=$True)]
    [String]$ReportId,
    [Parameter(Mandatory=$True)]
    [String]$TechniqueName,
    [Switch]$AuditOnly
  )

  $LocalClasses = New-ClassContext
  $ResourcesDir = $PSScriptRoot + "\resources" 
  $LocalClasses = Merge-ClassContext $LocalClasses $(Service-Started -Name "sshd" -ComponentName "Service started" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly).get_item("classes")
  $Class = "service_started_sshd_${report_data.canonified_directive_id}_kept" 
  if (Evaluate-Class $Class $LocalClasses $SystemClasses) {
    $LocalClasses = Merge-ClassContext $LocalClasses $(Command-Execution -Command "write-output \"bob3\"" -ComponentName "Command execution" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly).get_item("classes")
  }
  else {
    _rudder_common_report_na -ComponentName "Command execution" -ComponentKey "write-output \"bob3\"" -Message "Not applicable" -ReportId $ReportId -TechniqueName $TechniqueName -AuditOnly:$AuditOnly
  }
}
Actions #2

Updated by Benoît PECCATTE 8 months ago

  • Status changed from New to In progress
  • Assignee set to Benoît PECCATTE
Actions #3

Updated by Benoît PECCATTE 8 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Benoît PECCATTE to Félix DALLIDET
  • Pull Request set to https://github.com/Normation/rudder/pull/3954
Actions #4

Updated by Benoît PECCATTE 8 months ago

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

Updated by Vincent MEMBRÉ 8 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 7.0.0~beta2 which was released today.

Actions

Also available in: Atom PDF