Commit 1df07b2
committed
Fetch the registry value not the type
Facter's product release resolver called `Win32::Registry#each` and incorrectly
assumed the second parameter was the `value`, when actually it was the `type`.
Note the `each` method is an alias for `each_value`, which yields three
parameters: `name`, `type` and `value`[1]`
The issue wasn't noticed because the code also called `Win32::Registry#[]` to
get the value and the tests incorrectly stubbed the Windows registry behavior.
Commit 2c291fe assumed the second parameter was the `value`, as a result
the `os.windows` facts had a value of 1, which corresponds to `REG_SZ`[2]:
C:\> facter -j os.windows
"os.windows": {
"edition_id": 1,
..
}
This isn't the first time we've had problems with overstubbing in facter, see
6e7970e, 86048b5, 5818550
Fixes #2683
[1] https://github.com/ruby/ruby/blob/v3_2_3/ext/win32/lib/win32/registry.rb#L579
[2] https://github.com/ruby/ruby/blob/v3_2_3/ext/win32/lib/win32/registry.rb#L1141 parent a0dc406 commit 1df07b2
File tree
2 files changed
+9
-7
lines changed- lib/facter/resolvers/windows
- spec/facter/resolvers/windows
2 files changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | | - | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
0 commit comments