Project

General

Profile

Actions

Bug #21502

closed

Adapt webapp policy generation to 7.2 technique syntax

Added by François ARMAND over 2 years ago. Updated 9 months ago.

Status:
Released
Priority:
N/A
Category:
Web - Technique editor
Target version:
-
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No

Description

The new syntax is:

function My-Technique {
  [CmdletBinding()]
  param (
    [Parameter(Mandatory=$True)]
    [String]$ReportId,
    [Parameter(Mandatory=$True)]
    [String]$TechniqueName,
    [Rudder.PolicyMode]$PolicyMode
  )

  $ReportIdBase = $reportId.Substring(0,$reportId.Length-1)
  $localContext = [Rudder.Context]::new()
  $localContext.Merge($system_classes)
  $resourcesDir = $PSScriptRoot + "\resources" 

  # --------------Method Call 1------------- #
  $ReportId = $ReportIdBase+"8b575191-0ab0-4851-b05c-e7cde3726f05" 
  $common_params = @{
    ClassPrefix = "pwd" 
    ComponentKey = "pwd" 
    ComponentName = "Command execution" 
    PolicyMode = $PolicyMode
    ReportId = $ReportId
    TechniqueName = $TechniqueName
  }
  if ($localContext.Evaluate("sles_12")) {
    $call_params = @{
      Command = "pwd" 
      PolicyMode = $PolicyMode
    }
    $call = Command-Execution @call_params
    $compute_params = $common_params + @{
      MethodCall = $call
    }
    $context = Compute-Method-Call @compute_params
    $localContext.merge($context)
  } else {
    Rudder-Report-NA @common_params
  }

  # --------------Method Call 2------------- #
  # ...
}

Subtasks 1 (0 open1 closed)

Bug #21551: Adapt (more) technique writing to rudder dsc agent 7.2ReleasedFélix DALLIDETActions
Actions #1

Updated by François ARMAND over 2 years ago

  • Status changed from New to In progress
Actions #2

Updated by François ARMAND over 2 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Félix DALLIDET
  • Pull Request set to https://github.com/Normation/rudder/pull/4406
Actions #3

Updated by Anonymous over 2 years ago

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

Updated by François ARMAND over 2 years ago

  • Subtask #21551 added
Actions #5

Updated by François ARMAND over 2 years ago

  • Project changed from 78 to Rudder
  • Category changed from Rudder web app to Web - Technique editor
  • Target version deleted (7.2-next)
  • Regression set to No

All the code is in rudder, not the plugin (which is certainly not what we want)

Actions #7

Updated by Vincent MEMBRÉ 9 months ago

  • Status changed from Pending release to Released
Actions

Also available in: Atom PDF