想知道什麼是最好的方式來獲得DSC資源內的一些邏輯,而不訴諸編寫自定義DSC資源。示例如下。 我需要提供content
參數內置DSC資源File
。我不能把Configuration裏的Function函數返回那個值,似乎也不能在Content
標記裏面放置邏輯。對於這種情況,有什麼可能的辦法。DSC資源內部可能有複雜的邏輯嗎?
``` $文件路徑=加入路徑-Path 「$($ ENV:programdata)」 -ChildPath 「泊塢窗\ CONFIG \ daemon.json」
$filePath = Join-path -Path `"$($env:programdata)`" -ChildPath "docker\config\daemon.json`"
if (test-Path ($filePath))
{) { $jsonConfig = get-content $filePath | convertfrom-json
$jsonConfig.graph = $graphLocation
$jsonConfig | convertto-json
}
else { @{ graphLocation = "$graphLocation"} | convertto-json
}
```