Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Annih committed Nov 26, 2015
1 parent 0d5e2f8 commit 667a3c1
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 32 deletions.
38 changes: 17 additions & 21 deletions recipes/powershell2.rb
Expand Up @@ -24,36 +24,32 @@
case node['platform']
when 'windows'

require 'chef/win32/version'
windows_version = Chef::ReservedNames::Win32::Version.new
# 0x0C Server Datacenter (core installation)
# 0x27 Server Datacenter without Hyper-V (core installation)
# 0x0E Server Enterprise (core installation)
# 0x29 Server Enterprise without Hyper-V (core installation)
# 0x0D Server Standard (core installation)
# 0x28 Server Standard without Hyper-V (core installation)
# 0x1D Web Server (core installation)
is_core = [0x0C, 0x27, 0x0E, 0x29, 0x0D, 0x28, 0x1D].include? node['kernel']['os_info']['operating_system_sku']
nt_version = node['platform_version'].to_f

if (windows_version.windows_server_2012? || windows_version.windows_8?) && windows_version.core?
# Windows Server 2012 Core does not come with Powershell 2.0 enabled
windows_feature 'MicrosoftWindowsPowerShellV2' do
action :install
end
windows_feature 'MicrosoftWindowsPowerShellV2-WOW64' do
action :install
only_if { node['kernel']['machine'] == 'x86_64' }
end
include_recipe 'ms_dotnet::ms_dotnet2'

elsif (windows_version.windows_server_2008_r2? || windows_version.windows_7?) && windows_version.core?
# Windows Server 2008 R2 Core does not come with .NET or Powershell 2.0 enabled
include_recipe 'ms_dotnet::ms_dotnet2'
if is_core && nt_version.between?(6.1, 6.2)
feature_suffix = 'V2' if nt_version == 6.2

windows_feature 'MicrosoftWindowsPowerShell' do
windows_feature "MicrosoftWindowsPowerShell#{feature_suffix}" do
action :install
end
windows_feature 'MicrosoftWindowsPowerShell-WOW64' do

windows_feature "MicrosoftWindowsPowerShell#{feature_suffix}-WOW64" do
action :install
only_if { node['kernel']['machine'] == 'x86_64' }
end

elsif windows_version.windows_server_2008? || windows_version.windows_server_2003_r2? ||
windows_version.windows_server_2003? || windows_version.windows_xp?

include_recipe 'ms_dotnet::ms_dotnet2'

# WMF 2.0 is required for XP and Windows Server 2003
elsif nt_version.between?(5.1, 5.2)
# Reboot if user specifies doesn't specify no_reboot
include_recipe 'powershell::windows_reboot' unless node['powershell']['installation_reboot_mode'] == 'no_reboot'

Expand Down
9 changes: 5 additions & 4 deletions recipes/powershell3.rb
Expand Up @@ -24,10 +24,11 @@
case node['platform']
when 'windows'

require 'chef/win32/version'
windows_version = Chef::ReservedNames::Win32::Version.new

if windows_version.windows_server_2008? || windows_version.windows_server_2008_r2? || windows_version.windows_7?
nt_version = node['platform_version'].to_f
# Powershell 3.0 is only compatible with:
# * Windows NT 6.0 server (Windows Server 2008 SP2 not vista)
# * Windows NT 6.1 (Windows Server 2008R2 & Windows 7.1)
if (nt_version == 6.0 && node['kernel']['os_info']['product_type'] != 0x1) || nt_version == 6.1

# For Windows Server 2008 ensure that Powershell 2 is already installed and so is BITS 4.0
if windows_version.windows_server_2008?
Expand Down
8 changes: 5 additions & 3 deletions recipes/powershell4.rb
Expand Up @@ -22,10 +22,12 @@
# http://www.microsoft.com/en-us/download/details.aspx?id=40855

if node['platform'] == 'windows'
require 'chef/win32/version'
windows_version = Chef::ReservedNames::Win32::Version.new

if windows_version.windows_server_2008_r2? || windows_version.windows_7? || windows_version.windows_server_2012?
nt_version = node['platform_version'].to_f
# WMF 4.0 is only compatible with:
# * Windows NT 6.1 (Windows Server 2008R2 & Windows 7.1)
# * Windows NT 6.2 Server (Windows Server 2012 not Windows 8)
if nt_version == 6.1 || (nt_version == 6.2 && node['kernel']['os_info']['product_type'] != 0x1)

# Ensure .NET 4.5 is installed or installation will fail silently per Microsoft.
fail 'Attribute ms_dotnet.v4.version is not configured to install .NET4.5 as required for Powershell4' if node.default['ms_dotnet']['v4']['version'] < '4.5'
Expand Down
7 changes: 3 additions & 4 deletions recipes/powershell5.rb
Expand Up @@ -26,11 +26,10 @@
case node['platform']
when 'windows'

require 'chef/win32/version'
windows_version = Chef::ReservedNames::Win32::Version.new

if windows_version.windows_server_2012_r2? || windows_version.windows_8_1?
nt_version = node['platform_version'].to_f

# Handle WMFC install on 2012R2 and 8.1 only (yet)
if nt_version == 6.3
include_recipe 'powershell::windows_reboot' unless node['powershell']['installation_reboot_mode'] == 'no_reboot'

windows_package 'Windows Management Framework Core 5.0' do
Expand Down
53 changes: 53 additions & 0 deletions toto
@@ -0,0 +1,53 @@
PRODUCT_BUSINESS = 0x00000006 # Business
PRODUCT_BUSINESS_N = 0x00000010 # Business N
PRODUCT_CLUSTER_SERVER = 0x00000012 # HPC Edition
PRODUCT_DATACENTER_SERVER = 0x00000008 # Server Datacenter (full installation)
PRODUCT_DATACENTER_SERVER_CORE = 0x0000000C # Server Datacenter (core installation)
PRODUCT_DATACENTER_SERVER_CORE_V = 0x00000027 # Server Datacenter without Hyper-V (core installation)
PRODUCT_DATACENTER_SERVER_V = 0x00000025 # Server Datacenter without Hyper-V (full installation)
PRODUCT_ENTERPRISE = 0x00000004 # Enterprise
PRODUCT_ENTERPRISE_E = 0x00000046 # Not supported
PRODUCT_ENTERPRISE_N = 0x0000001B # Enterprise N
PRODUCT_ENTERPRISE_SERVER = 0x0000000A # Server Enterprise (full installation)
PRODUCT_ENTERPRISE_SERVER_CORE = 0x0000000E # Server Enterprise (core installation)
PRODUCT_ENTERPRISE_SERVER_CORE_V = 0x00000029 # Server Enterprise without Hyper-V (core installation)
PRODUCT_ENTERPRISE_SERVER_IA64 = 0x0000000F # Server Enterprise for Itanium-based Systems
PRODUCT_ENTERPRISE_SERVER_V = 0x00000026 # Server Enterprise without Hyper-V (full installation)
PRODUCT_HOME_BASIC = 0x00000002 # Home Basic
PRODUCT_HOME_BASIC_E = 0x00000043 # Not supported
PRODUCT_HOME_BASIC_N = 0x00000005 # Home Basic N
PRODUCT_HOME_PREMIUM = 0x00000003 # Home Premium
PRODUCT_HOME_PREMIUM_E = 0x00000044 # Not supported
PRODUCT_HOME_PREMIUM_N = 0x0000001A # Home Premium N
PRODUCT_HYPERV = 0x0000002A # Microsoft Hyper-V Server
PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = 0x0000001E # Windows Essential Business Server Management Server
PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = 0x00000020 # Windows Essential Business Server Messaging Server
PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = 0x0000001F # Windows Essential Business Server Security Server
PRODUCT_PROFESSIONAL = 0x00000030 # Professional
PRODUCT_PROFESSIONAL_E = 0x00000045 # Not supported
PRODUCT_PROFESSIONAL_N = 0x00000031 # Professional N
PRODUCT_SERVER_FOR_SMALLBUSINESS = 0x00000018 # Windows Server 2008 for Windows Essential Server Solutions
PRODUCT_SERVER_FOR_SMALLBUSINESS_V = 0x00000023 # Windows Server 2008 without Hyper-V for Windows Essential Server Solutions
PRODUCT_SERVER_FOUNDATION = 0x00000021 # Server Foundation
PRODUCT_HOME_PREMIUM_SERVER = 0x00000022 # Windows Home Server 2011
PRODUCT_SB_SOLUTION_SERVER = 0x00000032 # Windows Small Business Server 2011 Essentials
PRODUCT_HOME_SERVER = 0x00000013 # Windows Storage Server 2008 R2 Essentials
PRODUCT_SMALLBUSINESS_SERVER = 0x00000009 # Windows Small Business Server
PRODUCT_SOLUTION_EMBEDDEDSERVER = 0x00000038 # Windows MultiPoint Server
PRODUCT_STANDARD_SERVER = 0x00000007 # Server Standard (full installation)
PRODUCT_STANDARD_SERVER_CORE = 0x0000000D # Server Standard (core installation)
PRODUCT_STANDARD_SERVER_CORE_V = 0x00000028 # Server Standard without Hyper-V (core installation)
PRODUCT_STANDARD_SERVER_V = 0x00000024 # Server Standard without Hyper-V (full installation)
PRODUCT_STARTER = 0x0000000B # Starter
PRODUCT_STARTER_E = 0x00000042 # Not supported
PRODUCT_STARTER_N = 0x0000002F # Starter N
PRODUCT_STORAGE_ENTERPRISE_SERVER = 0x00000017 # Storage Server Enterprise
PRODUCT_STORAGE_EXPRESS_SERVER = 0x00000014 # Storage Server Express
PRODUCT_STORAGE_STANDARD_SERVER = 0x00000015 # Storage Server Standard
PRODUCT_STORAGE_WORKGROUP_SERVER = 0x00000016 # Storage Server Workgroup
PRODUCT_UNDEFINED = 0x00000000 # An unknown product
PRODUCT_ULTIMATE = 0x00000001 # Ultimate
PRODUCT_ULTIMATE_E = 0x00000047 # Not supported
PRODUCT_ULTIMATE_N = 0x0000001C # Ultimate N
PRODUCT_WEB_SERVER = 0x00000011 # Web Server (full installation)
PRODUCT_WEB_SERVER_CORE = 0x0000001D # Web Server (core installation)

0 comments on commit 667a3c1

Please sign in to comment.