Skip to content

Commit c8168c0

Browse files
authored
Merge branch 'main' into add-sshdconfig
2 parents 0bfa46b + 723825a commit c8168c0

File tree

17 files changed

+1344
-51
lines changed

17 files changed

+1344
-51
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Rust
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ "main", "release/v3.0.0", "release/v3.1" ]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [ "main", "release/v3.0.0", "release/v3.1" ]
88
paths-ignore:
99
- "docs/**"
1010
- "*.md"

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ if (!$SkipBuild) {
262262
}
263263

264264
# make sure dependencies are built first so clippy runs correctly
265-
$windows_projects = @("pal", "registry", "reboot_pending", "wmi-adapter", "configurations/windows", 'extensions/appx')
265+
$windows_projects = @("pal", "registry_lib", "registry", "reboot_pending", "wmi-adapter", "configurations/windows", 'extensions/appx')
266266
$macOS_projects = @("resources/brew")
267267
$linux_projects = @("resources/apt")
268268

dsc/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dsc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dsc"
3-
version = "3.1.0-preview.7"
3+
version = "3.2.0-preview.1"
44
edition = "2021"
55

66
[profile.release]

dsc/src/resource_command.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ pub fn get_all(dsc: &DscManager, resource_type: &str, format: Option<&GetOutputF
116116
let format = match format {
117117
Some(&GetOutputFormat::PrettyJson) => Some(&OutputFormat::PrettyJson),
118118
Some(&GetOutputFormat::Yaml) => Some(&OutputFormat::Yaml),
119+
None => None,
119120
_ => Some(&OutputFormat::Json),
120121
};
121122
write_object(&json, format, include_separator);

powershell-adapter/Tests/win_powershellgroup.tests.ps1

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ Describe 'WindowsPowerShell adapter resource tests - requires elevated permissio
66
BeforeAll {
77
if ($isWindows) {
88
winrm quickconfig -quiet -force
9-
}
10-
$OldPSModulePath = $env:PSModulePath
11-
$env:PSModulePath += [System.IO.Path]::PathSeparator + $PSScriptRoot
9+
$OldPSModulePath = $env:PSModulePath
10+
$env:PSModulePath += [System.IO.Path]::PathSeparator + $PSScriptRoot
1211

13-
$winpsConfigPath = Join-path $PSScriptRoot "winps_resource.dsc.yaml"
14-
if ($isWindows) {
15-
$cacheFilePath_v5 = Join-Path $env:LocalAppData "dsc" "WindowsPSAdapterCache.json"
12+
$winpsConfigPath = Join-path $PSScriptRoot "winps_resource.dsc.yaml"
13+
if ($isWindows) {
14+
$cacheFilePath_v5 = Join-Path $env:LocalAppData "dsc" "WindowsPSAdapterCache.json"
15+
}
1616
}
1717
}
1818
AfterAll {
19-
$env:PSModulePath = $OldPSModulePath
19+
if ($isWindows) {
20+
$env:PSModulePath = $OldPSModulePath
2021

21-
# Remove after all the tests are done
22-
Remove-Module $script:winPSModule -Force -ErrorAction Ignore
22+
# Remove after all the tests are done
23+
Remove-Module $script:winPSModule -Force -ErrorAction Ignore
24+
}
2325
}
2426

2527
BeforeEach {
@@ -161,7 +163,7 @@ resources:
161163
- "[resourceId('Microsoft.Windows/WindowsPowerShell', 'File')]"
162164
- name: TestPSRepository
163165
type: PSTestModule/TestPSRepository
164-
properties:
166+
properties:
165167
Name: NuGet
166168
dependsOn:
167169
- "[resourceId('Microsoft.Windows/WindowsPowerShell', 'File')]"
@@ -201,7 +203,7 @@ resources:
201203
type: PsDesiredStateConfiguration/Service
202204
properties:
203205
Name: Spooler
204-
State: $SecondState
206+
State: $SecondState
205207
"@
206208

207209
$inDesiredState = if ($FirstState -eq $SecondState) {
@@ -242,11 +244,11 @@ resources:
242244
# Instead of calling dsc.exe we call the cmdlet directly to be able to test the output and mocks
243245
$resourceObject = Get-DscResourceObject -jsonInput $jsonInput
244246
$cacheEntry = Invoke-DscCacheRefresh -Module PSDesiredStateConfiguration
245-
247+
246248
$out = Invoke-DscOperation -Operation Test -DesiredState $resourceObject -dscResourceCache $cacheEntry
247249
$LASTEXITCODE | Should -Be 0
248250
$out.properties.InDesiredState.InDesiredState | Should -Be $false
249-
251+
250252
Should -Invoke -CommandName ConvertTo-SecureString -Exactly -Times 1 -Scope It
251253
}
252254

@@ -261,7 +263,7 @@ resources:
261263
Credential:
262264
UserName: 'User'
263265
OtherProperty: 'Password'
264-
"@
266+
"@
265267
# Compared to PowerShell we use test here as it filters out the properties
266268
$out = dsc config test -i $yaml 2>&1 | Out-String
267269
$LASTEXITCODE | Should -Be 2
@@ -339,7 +341,7 @@ class PSClassResource {
339341
}
340342
341343
[void] Set() {
342-
344+
343345
}
344346
345347
static [PSClassResource[]] Export()
@@ -374,23 +376,23 @@ class PSClassResource {
374376
}
375377

376378
It 'Get works with class-based PS DSC resources' -Skip:(!$IsWindows) {
377-
379+
378380
$out = dsc resource get -r PSClassResource/PSClassResource --input (@{Name = 'TestName' } | ConvertTo-Json) | ConvertFrom-Json
379381
$LASTEXITCODE | Should -Be 0
380382
$out.actualState.Name | Should -Be 'TestName'
381-
$propCount = $out.actualState | Get-Member -MemberType NoteProperty
383+
$propCount = $out.actualState | Get-Member -MemberType NoteProperty
382384
$propCount.Count | Should -Be 1 # Only the DscProperty should be returned
383385
}
384386

385387
It 'Set works with class-based PS DSC resources' -Skip:(!$IsWindows) {
386-
388+
387389
$out = dsc resource set -r PSClassResource/PSClassResource --input (@{Name = 'TestName' } | ConvertTo-Json) | ConvertFrom-Json
388390
$LASTEXITCODE | Should -Be 0
389391
$out.afterstate.InDesiredState | Should -Be $true
390392
}
391393

392394
It 'Export works with class-based PS DSC resources' -Skip:(!$IsWindows) {
393-
395+
394396
$out = dsc resource export -r PSClassResource/PSClassResource | ConvertFrom-Json
395397
$LASTEXITCODE | Should -Be 0
396398
$out | Should -Not -BeNullOrEmpty

process/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ fn get_task_list() -> Vec<ProcessInfo>
1313
let mut result = Vec::new();
1414
let mut s = System::new();
1515
s.refresh_processes(ProcessesToUpdate::All, true);
16+
let mut count = 0;
1617
for (pid, process) in s.processes() {
1718
let mut p = ProcessInfo::new();
1819
p.pid = pid.as_u32();
1920
p.name = process.name().to_string_lossy().to_string();
2021
p.cmdline = format!("{:?}", process.cmd());
2122
result.push(p);
23+
count += 1;
24+
if count > 3 {
25+
// limit to 3 processes as this is just for testing
26+
break;
27+
}
2228
}
2329

2430
result

registry/Cargo.lock

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

registry/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ strip = "symbols" # See split-debuginfo - allows us to drop the size b
2121
clap = { version = "4.5", features = ["derive"] }
2222
crossterm = "0.29"
2323
registry = "1.3"
24+
registry_lib = { path = "../registry_lib" }
2425
rust-i18n = { version = "3.1" }
2526
schemars = "0.9"
2627
serde = "1.0"

registry/locales/en-us.toml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,8 @@ findArgsKeysOnlyHelp = "Only find keys."
2727
findArgsValuesOnlyHelp = "Only find values."
2828
schemaAbout = "Retrieve JSON schema."
2929

30-
[config]
31-
# No localizable strings
32-
33-
[error]
34-
invalidHive = "Invalid hive"
35-
json = "JSON"
36-
registry = "Registry"
37-
registryKey = "Registry key"
38-
registryKeyNotFound = "Registry key not found"
39-
registryValue = "Registry value"
40-
utf16Conversion = "UTF-16 conversion failed due to interior NULL values for"
41-
unsupportedValueDataType = "Unsupported registry value data type"
42-
4330
[main]
4431
tracingInitError = "Unable to set global default tracing subscriber. Tracing is disabled."
4532
debugAttach = "attach debugger to pid %{pid} and press any key to continue"
4633
debugEventReadError = "Error: Failed to read event: %{err}"
4734
debugEventUnexpectedError = "Unexpected event: %{e}"
48-
49-
[registry_helper]
50-
whatIfCreateKey = "Key '%{subkey}' not found, would create it"
51-
removeErrorKeyNotExist = "Key already does not exist"
52-
removeDeletingSubKey = "Deleting subkey '%{name}' using %{parent}"

0 commit comments

Comments
 (0)