Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grains for future windows releases #50844

Merged
merged 2 commits into from Dec 13, 2018

Conversation

Projects
None yet
4 participants
@twangboy
Copy link
Contributor

commented Dec 12, 2018

What does this PR do?

This PR tries to future proof the release and version information displayed in the grains and in the version information for Salt.

Python reports os versions relative to the desktop release. To get the Server version we created a dictionary that correlated the desktop release to the server release. If we detected a server installation then we would use the dictionary to look up the associated server release. Since Microsoft has moved to a rolling release for Windows 10 desktop new server releases no longer have a corresponding desktop release. Windows just released Windows Server 2019 and Salt was still reporting 2016 as the server version.

This PR will base the release and version on the full platform name. Tested against the following data set:

versions = ['Windows 10 Home',
            'Windows 10 Pro',
            'Windows 10 Pro for Workstations',
            'Windows 10 Pro Education',
            'Windows 10 Enterprise',
            'Windows 10 Enterprise LTSB',
            'Windows 10 Education',
            'Windows 10 IoT Core',
            'Windows 10 IoT Enterprise',
            'Windows 10 S',
            'Windows 8.1',
            'Windows 8.1 Pro',
            'Windows 8.1 Enterprise',
            'Windows 8.1 OEM',
            'Windows 8.1 with Bing',
            'Windows 8',
            'Windows 8 Pro',
            'Windows 8 Enterprise',
            'Windows 8 OEM',
            'Windows 7 Starter',
            'Windows 7 Home Basic',
            'Windows 7 Home Premium',
            'Windows 7 Professional',
            'Windows 7 Enterprise',
            'Windows 7 Ultimate',
            'Windows Thin PC',
            'Windows Vista Starter',
            'Windows Vista Home Basic',
            'Windows Vista Home Premium',
            'Windows Vista Business',
            'Windows Vista Enterprise',
            'Windows Vista Ultimate',
            'Windows Server 2019 Essentials',
            'Windows Server 2019 Standard',
            'Windows Server 2019 Datacenter',
            'Windows Server 2016 Essentials',
            'Windows Server 2016 Standard',
            'Windows Server 2016 Datacenter',
            'Windows Server 2012 R2 Foundation',
            'Windows Server 2012 R2 Essentials',
            'Windows Server 2012 R2 Standard',
            'Windows Server 2012 R2 Datacenter',
            'Windows Server 2012 Foundation',
            'Windows Server 2012 Essentials',
            'Windows Server 2012 Standard',
            'Windows Server 2012 Datacenter',
            'Windows MultiPoint Server 2012',
            'Windows Server 2008 R2 Foundation',
            'Windows Server 2008 R2 Standard',
            'Windows Server 2008 R2 Enterprise',
            'Windows Server 2008 R2 Datacenter',
            'Windows Server 2008 R2 for Itanium-based Systems',
            'Windows Web Server 2008 R2',
            'Windows Storage Server 2008 R2',
            'Windows HPC Server 2008 R2',
            'Windows Small Business Server 2011',
            'Windows MultiPoint Server 2011',
            'Windows Home Server 2011',
            'Windows MultiPoint Server 2010',
            'Windows Server 2008 Standard',
            'Windows Server 2008 Enterprise',
            'Windows Server 2008 Datacenter',
            'Windows Server 2008 for Itanium-based Systems',
            'Windows Server Foundation 2008',
            'Windows Essential Business Server 2008',
            'Windows HPC Server 2008',
            'Windows Small Business Server 2008',
            'Windows Storage Server 2008',
            'Windows Web Server 2008']

They are detected as follows (osrelease, osfullname):

10      Windows 10 Home
10      Windows 10 Pro
10      Windows 10 Pro for Workstations
10      Windows 10 Pro Education
10      Windows 10 Enterprise
10      Windows 10 Enterprise LTSB
10      Windows 10 Education
10      Windows 10 IoT Core
10      Windows 10 IoT Enterprise
10      Windows 10 S
8.1     Windows 8.1
8.1     Windows 8.1 Pro
8.1     Windows 8.1 Enterprise
8.1     Windows 8.1 OEM
8.1     Windows 8.1 with Bing
8       Windows 8
8       Windows 8 Pro
8       Windows 8 Enterprise
8       Windows 8 OEM
7       Windows 7 Starter
7       Windows 7 Home Basic
7       Windows 7 Home Premium
7       Windows 7 Professional
7       Windows 7 Enterprise
7       Windows 7 Ultimate
Thin    Windows Thin PC
Vista   Windows Vista Starter
Vista   Windows Vista Home Basic
Vista   Windows Vista Home Premium
Vista   Windows Vista Business
Vista   Windows Vista Enterprise
Vista   Windows Vista Ultimate
2019Server      Windows Server 2019 Essentials
2019Server      Windows Server 2019 Standard
2019Server      Windows Server 2019 Datacenter
2016Server      Windows Server 2016 Essentials
2016Server      Windows Server 2016 Standard
2016Server      Windows Server 2016 Datacenter
2012ServerR2    Windows Server 2012 R2 Foundation
2012ServerR2    Windows Server 2012 R2 Essentials
2012ServerR2    Windows Server 2012 R2 Standard
2012ServerR2    Windows Server 2012 R2 Datacenter
2012Server      Windows Server 2012 Foundation
2012Server      Windows Server 2012 Essentials
2012Server      Windows Server 2012 Standard
2012Server      Windows Server 2012 Datacenter
2012Server      Windows MultiPoint Server 2012
2008ServerR2    Windows Server 2008 R2 Foundation
2008ServerR2    Windows Server 2008 R2 Standard
2008ServerR2    Windows Server 2008 R2 Enterprise
2008ServerR2    Windows Server 2008 R2 Datacenter
2008ServerR2    Windows Server 2008 R2 for Itanium-based Systems
2008ServerR2    Windows Web Server 2008 R2
2008ServerR2    Windows Storage Server 2008 R2
2008ServerR2    Windows HPC Server 2008 R2
2011Server      Windows Small Business Server 2011
2011Server      Windows MultiPoint Server 2011
2011Server      Windows Home Server 2011
2010Server      Windows MultiPoint Server 2010
2008Server      Windows Server 2008 Standard
2008Server      Windows Server 2008 Enterprise
2008Server      Windows Server 2008 Datacenter
2008Server      Windows Server 2008 for Itanium-based Systems
2008Server      Windows Server Foundation 2008
2008Server      Windows Essential Business Server 2008
2008Server      Windows HPC Server 2008
2008Server      Windows Small Business Server 2008
2008Server      Windows Storage Server 2008
2008Server      Windows Web Server 2008

What issues does this PR fix or reference?

#50758

Tests written?

No

Commits signed with GPG?

No

twangboy added some commits Dec 12, 2018

@dwoz

dwoz approved these changes Dec 12, 2018

@twangboy

This comment has been minimized.

Copy link
Contributor Author

commented Dec 12, 2018

@cachedout cachedout merged commit fdff675 into saltstack:2017.7 Dec 13, 2018

9 of 10 checks passed

jenkins/pr/py3-centos-7 The py3-centos-7 job has failed
Details
WIP Ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint Python lint test has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py2-windows-2016 The py2-windows-2016 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
jenkins/pr/py3-windows-2016 The py3-windows-2016 job has passed
Details

@twangboy twangboy deleted the twangboy:fix_grains branch Dec 27, 2018

@andzn

This comment has been minimized.

Copy link

commented Mar 22, 2019

@twangboy it seems that after this change the os_release is set to None on Windows Embedded Standard. And because there's logic that expects the os_release grain is set, the salt-minion doesn't start.
However before this change the salt minion worked on "Windows Embedded". And even now, if I change the code to read the os_release using platform.release(), the salt-minion starts working again.
It seems that the os info.caption is "Windows Embedded Standard ". Since the caption doesn't contain the version in it, the new code resolves it to unknown, whereas platform.release() returned "7" on windows embedded standard 7. Since, latest versions of Windows Embedded have been renamed to Windows 10 IOT, I suspect this is an issue only with older versions of Windows Embedded.
Therefore, would it be fine to fall-back to platform.release() if the info.caption contains Embedded?

@twangboy

This comment has been minimized.

Copy link
Contributor Author

commented Mar 23, 2019

@andzn Yeah, that's probably a good idea. We would have to handle the mapping the same way. Would you be able to submit a PR?

@andzn

This comment has been minimized.

Copy link

commented Mar 25, 2019

I can try. I tried to find out what the product names are for various windows embedded OSes and here's the result of my research:

Windows Embedded 8.1 Industry Pro -> Windows Embedded 8.1 Industry Pro
Windows Embedded 8 Industry Pro -> Windows Embedded 8 Industry Pro
Windows POSReady 7-> Windows Embedded Standard
Windows Embedded Standard 7-> Windows Embedded Standard
Windows Embedded POSReady 2009-> Microsoft Windows Server 2003
Windows Embedded Standard 2009-> Microsoft Windows XP
Windows XP Embedded -> Microsoft Windows XP

As a side note, in order to obtain the information above, I haven't created VMs with all these OSes, due to time constraints. Instead, I have analyzed the registry hives from their installers.
It seems that the only product name that doesn't contain the version in it is "Windows Embedded Standard". Therefore I think I would only fix that specific OS. Something like this:

elif 'Windows Embedded Standard' in osinfo.Caption:
    os_release =  platform.release()

What do you think, @twangboy?

And yes, there's also XP which is not currently handled as a version, but I think that is on purpose. Right?

@twangboy

This comment has been minimized.

Copy link
Contributor Author

commented Mar 26, 2019

We should probably create a test for this that goes through all the known names and checks that the correct grains are created. Could you create a new issue for this and I'll see if I can get to it.

@andzn

This comment has been minimized.

Copy link

commented Mar 27, 2019

Ok, thanks! I opened issue #52339.

@twangboy

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2019

I just submitted a PR for that...
#52344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.