Merge pull request #59619 from mxrss2/59611-bug-windows-server-core-container-grains

Update to RE #59611 -- Server Core Grains issue
This commit is contained in:
Gareth J. Greenaway 2022-10-28 11:32:35 -07:00 committed by GitHub
commit 14f5b24349
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -933,7 +933,7 @@ Salt 3002.2 (2020-11-16)
Fixed
-----
- Fix server core grains issue when running inside a windows container (#59611)
- Change dict check to isinstance instead of type() for key_values in file.keyvalue. (#57758)
- Fail when func_ret is False when using the new module.run syntax. (#57768)
- Fix comparison of certificate values (#58296)

View file

@ -1438,7 +1438,9 @@ def _windows_os_release_grain(caption, product_type):
release = ""
if "Server" in caption:
# Edge case here to handle MS Product that doesn't contain a year
if re.match(r"^Microsoft Hyper-V Server$", caption):
if re.match(
r"^Microsoft[^\d]+(Server|Datacenter|Standard|Essentials)$", caption
):
version = "2019"
else:
for item in caption.split(" "):

View file

@ -1505,6 +1505,13 @@ def test__windows_os_release_grain(subtests):
version = core._windows_os_release_grain(caption, 1)
assert version == "2019Server"
# Microsoft Windows Server Datacenter
# Issue https://github.com/saltstack/salt/issue/59611
caption = "Microsoft Windows Server Datacenter"
with subtests.test(caption):
version = core._windows_os_release_grain(caption, 1)
assert version == "2019Server"
@pytest.mark.skip_unless_on_linux
def test_linux_memdata():