diff options
author | Bryan McLellan <btm@loftninjas.org> | 2018-12-11 16:46:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-11 16:46:28 -0500 |
commit | bc1f99963e2359399d2396b8541ae5712c7dfe70 (patch) | |
tree | 1b4ba64d3a7d545b45dd5d6da1fe3279610966f0 | |
parent | b0e0a264892e69e6cfbbc445545741ed73468be9 (diff) | |
parent | 526772cfea48dd32fe95a75ea8b6764562b52f13 (diff) | |
download | chef-bc1f99963e2359399d2396b8541ae5712c7dfe70.tar.gz |
Merge pull request #8033 from chef/sp/2019_version_detection
Chef 14: Windows Server 2019 version detection
-rw-r--r-- | lib/chef/win32/version.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb index 9a506aa740..07f2b8d7a8 100644 --- a/lib/chef/win32/version.rb +++ b/lib/chef/win32/version.rb @@ -44,25 +44,25 @@ class Chef def self.method_name_from_marketing_name(marketing_name) "#{marketing_name.gsub(/\s/, '_').tr('.', '_').downcase}?" - # "#{marketing_name.gsub(/\s/, '_').gsub(//, '_').downcase}?" end private_class_method :method_name_from_marketing_name WIN_VERSIONS = { - "Windows 10" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } }, - "Windows Server 2016" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } }, - "Windows 8.1" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } }, - "Windows Server 2012 R2" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } }, - "Windows 8" => { major: 6, minor: 2, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } }, - "Windows Server 2012" => { major: 6, minor: 2, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } }, - "Windows 7" => { major: 6, minor: 1, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } }, - "Windows Server 2008 R2" => { major: 6, minor: 1, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } }, - "Windows Server 2008" => { major: 6, minor: 0, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } }, - "Windows Vista" => { major: 6, minor: 0, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } }, - "Windows Server 2003 R2" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask| get_system_metrics(SM_SERVERR2) != 0 } }, - "Windows Home Server" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask| (suite_mask & VER_SUITE_WH_SERVER) == VER_SUITE_WH_SERVER } }, - "Windows Server 2003" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask| get_system_metrics(SM_SERVERR2) == 0 } }, + "Windows Server 2019" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number >= 17763 } }, + "Windows 10" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } }, + "Windows Server 2016" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION && build_number <= 14393 } }, + "Windows 8.1" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } }, + "Windows Server 2012 R2" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION } }, + "Windows 8" => { major: 6, minor: 2, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } }, + "Windows Server 2012" => { major: 6, minor: 2, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION } }, + "Windows 7" => { major: 6, minor: 1, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } }, + "Windows Server 2008 R2" => { major: 6, minor: 1, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION } }, + "Windows Server 2008" => { major: 6, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type != VER_NT_WORKSTATION } }, + "Windows Vista" => { major: 6, minor: 0, callable: lambda { |product_type, suite_mask, build_number| product_type == VER_NT_WORKSTATION } }, + "Windows Server 2003 R2" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask, build_number| get_system_metrics(SM_SERVERR2) != 0 } }, + "Windows Home Server" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask, build_number| (suite_mask & VER_SUITE_WH_SERVER) == VER_SUITE_WH_SERVER } }, + "Windows Server 2003" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask, build_number| get_system_metrics(SM_SERVERR2) == 0 } }, "Windows XP" => { major: 5, minor: 1 }, "Windows 2000" => { major: 5, minor: 0 }, }.freeze @@ -88,7 +88,7 @@ class Chef define_method(method_name) do (@major_version == v[:major]) && (@minor_version == v[:minor]) && - (v[:callable] ? v[:callable].call(@product_type, @suite_mask) : true) + (v[:callable] ? v[:callable].call(@product_type, @suite_mask, @build_number) : true) end marketing_names << [k, method_name] end |