Add Test-DSCConfigurationDataDeployment function and related enhancements

This commit is contained in:
Torsten Brendgen
2026-07-03 12:34:48 +02:00
parent fb9209456b
commit c93f4ebc5c
7 changed files with 242 additions and 7 deletions

View File

@@ -0,0 +1,34 @@
function Get-ConfigurationDataSourceFileInfo {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]
$Path,
[Parameter(Mandatory=$true)]
[string]
$BasePath,
[Parameter(Mandatory=$false)]
[switch]
$UseRelativePath
)
$ResolvedPath = Resolve-ConfigurationDataTemplatePath -Path $Path -BasePath $BasePath
$Item = Get-Item -LiteralPath $ResolvedPath
$Hash = Get-FileHash -LiteralPath $ResolvedPath -Algorithm SHA256
$DisplayPath = if($UseRelativePath){
ConvertTo-ConfigurationDataRelativePath -Path $ResolvedPath -BasePath $BasePath
}else{
$ResolvedPath
}
[ordered]@{
Path = $DisplayPath
Hash = $Hash.Hash
Algorithm = $Hash.Algorithm
Size = $Item.Length
LastWriteTimeUtc = $Item.LastWriteTimeUtc.ToString("o")
}
}

View File

@@ -0,0 +1,19 @@
function Resolve-ConfigurationDataSourcePath {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]
$Path,
[Parameter(Mandatory=$true)]
[string]
$DeploymentPath
)
$BasePath = Split-Path -Path (Repair-ConfigurationDataPathEncoding -Path $DeploymentPath) -Parent
if([string]::IsNullOrWhiteSpace($BasePath)){
$BasePath = (Get-Location).Path
}
return Resolve-ConfigurationDataTemplatePath -Path $Path -BasePath $BasePath
}