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 8 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

Also available in: Atom PDF