Actions
Bug #19199
closedTechniques using a condition containing a variable are not canonified correctly with dsc agent
Status:
Released
Priority:
N/A
Assignee:
Category:
Web - Technique editor
Target version:
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:
Description
When creating a technique, if you use a condition based on a variable content, it will not canonify its value, leading to malformed conditions.
The logic should already be written since on the CfEngine technique side it is properly canonified.
We currently generate something like:
function Test-Technique { [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$reportId, [parameter(Mandatory=$true)] [string]$techniqueName, [parameter(Mandatory=$true)] [string]$File, [switch]$auditOnly ) $local_classes = New-ClassContext $resources_dir = $PSScriptRoot + "\resources" $local_classes = Merge-ClassContext $local_classes $(File-Content -File "${file}" -Lines "my_content" -Enforce "true" -componentName "File content" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly).get_item("classes") $class = "any.(file_lines_present_${file}_repaired)" if (Evaluate-Class $class $local_classes $system_classes) { $local_classes = Merge-ClassContext $local_classes $(File-Content -File "C:\result.txt" -Lines "un peu de contenu sur plusieurs lignes" -Enforce "true" -componentName "File content" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly).get_item("classes") } else { _rudder_common_report_na -componentName "File content" -componentKey "C:\result.txt" -message "Not applicable" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly } }
And we want something like:
function Test-Technique { [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$reportId, [parameter(Mandatory=$true)] [string]$techniqueName, [parameter(Mandatory=$true)] [string]$File, [switch]$auditOnly ) $local_classes = New-ClassContext $resources_dir = $PSScriptRoot + "\resources" $local_classes = Merge-ClassContext $local_classes $(File-Content -File "${file}" -Lines "my_content" -Enforce "true" -componentName "File content" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly).get_item("classes") $class = "any.(file_lines_present_" + $(Canonify-Class $file) + "_repaired)" if (Evaluate-Class $class $local_classes $system_classes) { $local_classes = Merge-ClassContext $local_classes $(File-Content -File "C:\result.txt" -Lines "un peu de contenu sur plusieurs lignes" -Enforce "true" -componentName "File content" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly).get_item("classes") } else { _rudder_common_report_na -componentName "File content" -componentKey "C:\result.txt" -message "Not applicable" -reportId $reportId -techniqueName $techniqueName -auditOnly:$auditOnly } }
The diff is on the lines:
$class = "any.(file_lines_present_${file}_repaired)"
and
$class = "any.(file_lines_present_" + $(Canonify-Class $file) + "_repaired)"
Updated by Vincent MEMBRÉ over 3 years ago
- Project changed from 78 to Rudder
- Subject changed from Conditions containing a variable are not properly canonified to Conditions containing a variable are not canonfied with dsc agnt
- Category changed from Generic methods to Web - Technique editor
- Target version changed from 6.1-1.22 to 6.1.13
Updated by Vincent MEMBRÉ over 3 years ago
- Status changed from New to In progress
Updated by Vincent MEMBRÉ over 3 years ago
- Assignee changed from Vincent MEMBRÉ to François ARMAND
- Pull Request set to https://github.com/Normation/rudder/pull/3608
Updated by Vincent MEMBRÉ over 3 years ago
- Status changed from In progress to Pending technical review
Updated by Vincent MEMBRÉ over 3 years ago
- Subject changed from Conditions containing a variable are not canonfied with dsc agnt to Techniques using a condition containing a variable are not canonified correctly with dsc agent
Updated by Vincent MEMBRÉ over 3 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|d296449c75f6fc99fc39dabf90a6f5920c5b21ef.
Updated by Benoît PECCATTE over 3 years ago
- Fix check changed from To do to Checked
Updated by Vincent MEMBRÉ over 3 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 6.1.13 and 6.2.7 which were released today.
Actions