Skip to content

Commit 614c1d7

Browse files
committed
Desired State Configuration 3.0
1 parent 30f49b7 commit 614c1d7

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

dsc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Desired State Configuration 3.0
2+
3+
- [ExtensionManifestV2Availability.dsc](https://developer.chrome.com/docs/extensions/develop/migrate/mv2-deprecation-timeline) - enable support for chrome extensions V2

dsc/run.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
$validation = dsc config test -f .\validate.dsc.yml -o json | ConvertFrom-Json
2+
foreach ($r in $validation.results) {
3+
if ($r.result.inDesiredState -eq $false) {
4+
throw "[FAIL] $($r.name) [$($r.type)]"
5+
}
6+
}
7+
8+
Get-ChildItem .\steps -Filter '*.dsc.yml' -Recurse | ForEach-Object {
9+
$step = $_.FullName
10+
Write-Host "[INFO] Running step: $step" -ForegroundColor DarkGray
11+
$test = dsc config test -f $step -o json | ConvertFrom-Json
12+
$test.results | % {
13+
if ($_.result.inDesiredState -eq $true) {
14+
Write-Host "[OK] $($_.name) [$($_.type)]" -ForegroundColor Green
15+
}
16+
else {
17+
Write-Host "[APPLY] $($_.name) [$($_.type)]" -ForegroundColor Yellow
18+
}
19+
}
20+
21+
[bool[]]$states = $test.results.result.inDesiredState
22+
if ( $states.Contains($false)) {
23+
$setResult = dsc config set -f $step -o json | ConvertFrom-Json
24+
if ($LASTEXITCODE -ne 0) {
25+
throw "[FATAL] Couldn't set the desired state for $step"
26+
}
27+
}
28+
}
29+
30+
if ($LASTEXITCODE -eq 0) {
31+
Write-Host "[PASS] All resources are in desired state" -ForegroundColor Green
32+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
2+
resources:
3+
- name: Manifest V2 Availability
4+
type: Microsoft.Windows/Registry
5+
properties:
6+
keyPath: HKLM\SOFTWARE\Policies\Google\Chrome\
7+
valueName: ExtensionManifestV2Availability
8+
valueData:
9+
DWord: 2

dsc/validate.dsc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
2+
3+
resources:
4+
- name: Validate the OS is Windows
5+
type: Microsoft/OSInfo
6+
properties:
7+
family: Windows
8+

0 commit comments

Comments
 (0)