beaker 6.5.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/beaker/host/windows/group.rb +14 -0
- data/lib/beaker/host/windows/user.rb +14 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/host/windows/group_spec.rb +47 -28
- data/spec/beaker/host/windows/user_spec.rb +31 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7f2cf603e697740aab5a108dc690a6b5dd4800c52a9678941b826e422ee5e1
|
4
|
+
data.tar.gz: ce8bc6743384545f0d501fd54f221928bb731a16b3e1ce30a5494563aec0c69f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ec0253cd6bec780eac93937595b9f53a0be31e966123fd9c753b80661d145d226747537ca23b18aa79afcd7cc8932b83f3c8057a1f5a23cca4aa6ca332c7614
|
7
|
+
data.tar.gz: 5e495a3074e6fe7821bd810f7955542e130bb5673231d48c5107d138bfff7b15e22e3aacd84bd4adea66c4cfc52b20b6513b733051cf7bd4138e987e197774ec
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [6.6.0](https://github.com/voxpupuli/beaker/tree/6.6.0) (2025-03-27)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
- Changes to add powershell commands as wmic is deprecated in windows [\#1907](https://github.com/voxpupuli/beaker/pull/1907)
|
8
|
+
|
3
9
|
## [6.5.0](https://github.com/voxpupuli/beaker/tree/6.5.0) (2025-03-18)
|
4
10
|
|
5
11
|
**Implemented enhancements:**
|
@@ -14,6 +14,20 @@ module Windows::Group
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
# using powershell commands as wmic is deprecated in windows 2025
|
18
|
+
def group_list_using_powershell
|
19
|
+
execute('cmd /c echo "" | powershell.exe "Get-LocalGroup | Select-Object -ExpandProperty Name"') do |result|
|
20
|
+
groups = []
|
21
|
+
result.stdout.each_line do |line|
|
22
|
+
groups << line.strip or next
|
23
|
+
end
|
24
|
+
|
25
|
+
yield result if block_given?
|
26
|
+
|
27
|
+
groups
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
17
31
|
def group_get(name)
|
18
32
|
execute("net localgroup \"#{name}\"") do |result|
|
19
33
|
fail_test "failed to get group #{name}" if result.exit_code != 0
|
@@ -14,6 +14,20 @@ module Windows::User
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
# using powershell commands as wmic is deprecated in windows 2025
|
18
|
+
def user_list_using_powershell
|
19
|
+
execute('cmd /c echo "" | powershell.exe "Get-LocalUser | Select-Object -ExpandProperty Name"') do |result|
|
20
|
+
users = []
|
21
|
+
result.stdout.each_line do |line|
|
22
|
+
users << line.strip or next
|
23
|
+
end
|
24
|
+
|
25
|
+
yield result if block_given?
|
26
|
+
|
27
|
+
users
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
17
31
|
def user_get(name)
|
18
32
|
execute("net user \"#{name}\"") do |result|
|
19
33
|
fail_test "failed to get user #{name}" if result.exit_code != 0
|
data/lib/beaker/version.rb
CHANGED
@@ -7,47 +7,66 @@ module Beaker
|
|
7
7
|
end
|
8
8
|
|
9
9
|
let(:instance) { WindowsGroupTest.new }
|
10
|
-
let(:result) { double(:result, :stdout => group_list_output) }
|
11
|
-
let(:group_list_output) do
|
12
|
-
<<~EOS
|
13
|
-
Name=Foo
|
14
10
|
|
11
|
+
context "Group list" do
|
12
|
+
let(:result) { double(:result, :stdout => group_list_output) }
|
13
|
+
let(:group_list_output) do
|
14
|
+
<<~EOS
|
15
|
+
Name=Foo
|
15
16
|
|
16
|
-
Name=Bar6
|
17
17
|
|
18
|
+
Name=Bar6
|
18
19
|
|
19
|
-
EOS
|
20
|
-
end
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
Name=#{group_name}
|
21
|
+
EOS
|
22
|
+
end
|
25
23
|
|
24
|
+
def add_group(group_name)
|
25
|
+
group_list_output << <<~EOS
|
26
|
+
Name=#{group_name}
|
26
27
|
|
27
|
-
EOS
|
28
|
-
end
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
29
|
+
EOS
|
30
|
+
end
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
before do
|
33
|
+
expect(instance).to receive(:execute).with(/wmic group where/).and_yield(result)
|
34
|
+
end
|
37
35
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
36
|
+
it "gets a group_list" do
|
37
|
+
expect(instance.group_list).to eql(%w[Foo Bar6])
|
38
|
+
end
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
it "gets groups with spaces" do
|
41
|
+
add_group("With Spaces")
|
42
|
+
expect(instance.group_list).to eql(["Foo", "Bar6", "With Spaces"])
|
43
|
+
end
|
44
|
+
|
45
|
+
it "gets groups with dashes" do
|
46
|
+
add_group("With-Dashes")
|
47
|
+
expect(instance.group_list).to eql(%w[Foo Bar6 With-Dashes])
|
48
|
+
end
|
49
|
+
|
50
|
+
it "gets groups with underscores" do
|
51
|
+
add_group("With_Underscores")
|
52
|
+
expect(instance.group_list).to eql(%w[Foo Bar6 With_Underscores])
|
53
|
+
end
|
46
54
|
end
|
47
55
|
|
48
|
-
|
49
|
-
|
50
|
-
|
56
|
+
context "Group list using powershell" do
|
57
|
+
let(:group_list_using_powershell_output) do
|
58
|
+
<<~EOS
|
59
|
+
Foo1
|
60
|
+
Bar5
|
61
|
+
EOS
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:result1) { double(:result1, :stdout => group_list_using_powershell_output) }
|
65
|
+
|
66
|
+
it "gets a group_list using powershell" do
|
67
|
+
expect(instance).to receive(:execute).with(/powershell.exe "Get-LocalGroup | Select-Object -ExpandProperty Name/).and_yield(result1)
|
68
|
+
expect(instance.group_list_using_powershell).to eql(%w[Foo1 Bar5])
|
69
|
+
end
|
51
70
|
end
|
52
71
|
end
|
53
72
|
end
|
@@ -5,48 +5,50 @@ class WindowsUserTest
|
|
5
5
|
end
|
6
6
|
|
7
7
|
describe WindowsUserTest do
|
8
|
-
let(:
|
9
|
-
|
10
|
-
Name=Administrator
|
8
|
+
let(:host) { double.as_null_object }
|
9
|
+
let(:result) { Beaker::Result.new(host, command) }
|
11
10
|
|
11
|
+
describe '#user_list' do
|
12
|
+
let(:command) { 'cmd /c echo "" | wmic useraccount where localaccount="true" get name /format:value' }
|
12
13
|
|
14
|
+
let(:wmic_output) do
|
15
|
+
<<~EOS
|
16
|
+
Name=Administrator
|
13
17
|
|
14
18
|
|
15
19
|
|
16
|
-
Name=bob foo
|
17
20
|
|
18
21
|
|
22
|
+
Name=bob foo
|
19
23
|
|
20
24
|
|
21
25
|
|
22
|
-
Name=bob-dash
|
23
26
|
|
24
27
|
|
28
|
+
Name=bob-dash
|
25
29
|
|
26
30
|
|
27
31
|
|
28
|
-
Name=bob.foo
|
29
32
|
|
30
33
|
|
34
|
+
Name=bob.foo
|
31
35
|
|
32
36
|
|
33
37
|
|
34
|
-
Name=cyg_server
|
35
38
|
|
36
39
|
|
40
|
+
Name=cyg_server
|
37
41
|
|
38
42
|
|
39
43
|
|
40
44
|
|
41
45
|
|
42
46
|
|
43
|
-
EOS
|
44
|
-
end
|
45
|
-
let(:command) { 'cmd /c echo "" | wmic useraccount where localaccount="true" get name /format:value' }
|
46
|
-
let(:host) { double.as_null_object }
|
47
|
-
let(:result) { Beaker::Result.new(host, command) }
|
48
47
|
|
49
|
-
|
48
|
+
|
49
|
+
EOS
|
50
|
+
end
|
51
|
+
|
50
52
|
it 'returns user names list correctly' do
|
51
53
|
result.stdout = wmic_output
|
52
54
|
expect(subject).to receive(:execute).with(command).and_yield(result)
|
@@ -61,4 +63,20 @@ describe WindowsUserTest do
|
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
66
|
+
|
67
|
+
describe "#user_list_using_powershell" do
|
68
|
+
let(:command) { 'cmd /c echo "" | powershell.exe "Get-LocalUser | Select-Object -ExpandProperty Name"' }
|
69
|
+
let(:user_list_using_powershell_output) do
|
70
|
+
<<~EOS
|
71
|
+
Administrator
|
72
|
+
WDAGUtilityAccount
|
73
|
+
EOS
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'returns user names list correctly' do
|
77
|
+
result.stdout = user_list_using_powershell_output
|
78
|
+
expect(subject).to receive(:execute).with(command).and_yield(result)
|
79
|
+
expect(subject.user_list_using_powershell).to be === ["Administrator", "WDAGUtilityAccount"]
|
80
|
+
end
|
81
|
+
end
|
64
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakefs
|