Skip to content

Commit 5c371c9

Browse files
arampriceKauzClay
authored andcommitted
Remove unsupported windows versions
Signed-off-by: Clay Kauzlaric <[email protected]>
1 parent ce3b810 commit 5c371c9

File tree

47 files changed

+184
-2008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+184
-2008
lines changed

ci/azstemcell/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func parseFlags() error {
334334
flag.StringVar(&VhdURLFile, "vhdfile", "", "File containing the VHD URL with SAS token, env: AZURE_VHD_URL_FILE")
335335
flag.StringVar(&Version, "version", "", "Stemcell version, env: AZURE_VERSION")
336336
flag.StringVar(&VersionFile, "versionfile", "", "File containing the stemcell version, env: AZURE_VERSION_FILE")
337-
flag.StringVar(&WindowsOS, "os", "", "Windows version (2012R2, 2016, 1803, or 2019), env: AZURE_WINDOWS_OS")
337+
flag.StringVar(&WindowsOS, "os", "", "Windows version (2019), env: AZURE_WINDOWS_OS")
338338
flag.StringVar(&Destination, "dest", "", "Destination directory if not provided the current working directory will be used, env: AZURE_DESTINATION")
339339
flag.StringVar(&WorkDir, "temp", "", "Temporary directory (must be capable of storing +130GB of data), env: AZURE_TEMP_DIR")
340340

@@ -402,12 +402,12 @@ func validateFlags() []error {
402402
add(errors.New("missing required argument: [os]"))
403403
}
404404
switch strings.ToLower(WindowsOS) {
405-
case "2012r2", "2016", "1803", "2019":
405+
case "2019":
406406
// Ok
407-
case "windows2012r2", "windows2016", "windows1803", "windows2019":
407+
case "windows2019":
408408
WindowsOS = strings.TrimPrefix(WindowsOS, "windows")
409409
default:
410-
add(fmt.Errorf("OS version must be either 2012R2, 2016, 1803, or 2019 have: %s", WindowsOS))
410+
add(fmt.Errorf("OS version must be 2019 have: %s", WindowsOS))
411411
}
412412
if Destination == "" {
413413
add(errors.New("missing required argument: [dest]"))

ci/azstemcell/main_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import (
88
)
99

1010
func TestCreateManifest(t *testing.T) {
11-
const winOS = "2012R2"
11+
const winOS = "2019"
1212
const sha1 = "478da1732dba66e67e6a657fdf03b5614c513b04"
13-
const version = "1200.1"
13+
const version = "10.0.17763.410"
1414
const expected = `---
15-
name: bosh-azure-hyperv-windows2012R2-go_agent
16-
version: '1200.1'
15+
name: bosh-azure-hyperv-windows2019-go_agent
16+
version: '10.0.17763.410'
1717
bosh_protocol: 1
1818
sha1: 478da1732dba66e67e6a657fdf03b5614c513b04
19-
operating_system: windows2012R2
19+
operating_system: windows2019
2020
cloud_properties:
21-
name: bosh-azure-hyperv-windows2012R2-go_agent
22-
version: 1200.1
21+
name: bosh-azure-hyperv-windows2019-go_agent
22+
version: 10.0.17763.410
2323
infrastructure: azure
2424
hypervisor: hyperv
2525
disk: 40000
@@ -41,7 +41,7 @@ cloud_properties:
4141
if err := CreateManifest(name, version, winOS, sha1); err != nil {
4242
t.Error(err)
4343
}
44-
src, err := ioutil.ReadFile(name)
44+
src, err := os.ReadFile(name)
4545
if err != nil {
4646
t.Error(err)
4747
}

lib/packer/config/templates/provision_windows2019.json.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"inline": [
5656
"$ErrorActionPreference = \"Stop\";",
5757
"trap { $host.SetShouldExit(1) }",
58-
"Install-CFFeatures2016"
58+
"Install-CFFeatures"
5959
]
6060
},
6161
{

modules/BOSH.Agent/BOSH.Agent.Tests.ps1

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -235,52 +235,10 @@ Describe "Install-Agent" {
235235
{ Install-Agent -agentZipPath "some-agent-zip-path" } | Should -Throw "Provide the IaaS of your VM"
236236
}
237237
}
238+
238239
Context "when agent.zip is not provided" {
239240
It "throws" {
240241
{ Install-Agent -IaaS "some-Iaas" } | Should -Throw "Provide the path of your agent.zip"
241242
}
242243
}
243-
244-
Context "windows 2012R2" {
245-
It "calls helper functions with default arguments" {
246-
Mock -ModuleName BOSH.Agent Get-OSVersion { "windows2012R2" }
247-
Mock -ModuleName BOSH.Agent Test-Path { $true }
248-
249-
Mock -ModuleName BOSH.Agent -Verifiable Copy-Agent {} -ParameterFilter { $InstallDir -eq "C:\" -and $agentZipPath -eq "some-agent-zip-path" }
250-
251-
Mock -ModuleName BOSH.Agent -Verifiable Protect-Dir {} -ParameterFilter { $path -eq "C:\bosh" }
252-
Mock -ModuleName BOSH.Agent -Verifiable Protect-Dir {} -ParameterFilter { $path -eq "C:\var" }
253-
Mock -ModuleName BOSH.Agent -Verifiable Protect-Dir {} -ParameterFilter { $path -eq "C:\Windows\Panther" -and $disableInheritance -eq $false }
254-
255-
Mock -ModuleName BOSH.Agent Write-AgentConfig {} -Verifiable -ParameterFilter { $IaaS -eq "aws" -and $BoshDir -eq "C:\bosh" -and $EnableEphemeralDiskMounting -eq $false }
256-
Mock -ModuleName BOSH.Agent Set-Path {} -Verifiable -ParameterFilter { $Path -eq "C:\var\vcap\bosh\bin" }
257-
Mock -ModuleName BOSH.Agent Install-AgentService {} -Verifiable
258-
259-
Install-Agent -IaaS aws -agentZipPath "some-agent-zip-path"
260-
261-
Assert-VerifiableMock
262-
Assert-MockCalled Get-OSVersion -Times 1 -Scope It -ModuleName BOSH.Agent
263-
}
264-
}
265-
266-
Context "windows 2016" {
267-
It "calls helper functions with default arguments" {
268-
Mock -ModuleName BOSH.Agent Get-OSVersion { "window2016" }
269-
Mock -ModuleName BOSH.Agent Test-Path { $true }
270-
271-
Mock -ModuleName BOSH.Agent Copy-Agent {} -Verifiable -ParameterFilter { $InstallDir -eq "C:\" -and $agentZipPath -eq "some-agent-zip-path" }
272-
Mock -ModuleName BOSH.Agent Protect-Dir {} -Verifiable -ParameterFilter { $Path -eq "C:\bosh" }
273-
Mock -ModuleName BOSH.Agent Protect-Dir {} -Verifiable -ParameterFilter { $Path -eq "C:\var" }
274-
Mock -ModuleName BOSH.Agent Protect-Dir {} -Verifiable -ParameterFilter { $Path -eq "C:\Windows\Panther" -and $disableInheritance -eq $false }
275-
276-
Mock -ModuleName BOSH.Agent Write-AgentConfig {} -Verifiable -ParameterFilter { $IaaS -eq "aws" -and $BoshDir -eq "C:\bosh" -and $EnableEphemeralDiskMounting -eq $true }
277-
Mock -ModuleName BOSH.Agent Set-Path {} -Verifiable -ParameterFilter { $Path -eq "C:\var\vcap\bosh\bin" }
278-
Mock -ModuleName BOSH.Agent Install-AgentService {} -Verifiable
279-
280-
Install-Agent -IaaS aws -agentZipPath "some-agent-zip-path"
281-
282-
Assert-VerifiableMock
283-
Assert-MockCalled Get-OSVersion -Times 1 -Scope It -ModuleName BOSH.Agent
284-
}
285-
}
286244
}

modules/BOSH.Agent/BOSH.Agent.psm1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ function Install-Agent {
1414
[switch]$EnableEphemeralDiskMounting = $true
1515
)
1616

17-
$OsVersion = Get-OSVersion
18-
19-
if ($OSVersion -eq "windows2012R2") { $EnableEphemeralDiskMounting = $false }
20-
2117
Write-Log "Install-Agent: Started"
2218

2319
Copy-Agent -InstallDir "C:\" -agentZipPath $agentZipPath

modules/BOSH.CFCell/BOSH.CFCell.Tests.ps1

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,6 @@ Describe "Protect-CFCell" {
6363
}
6464

6565
Describe "Install-CFFeatures" {
66-
It "restarts computer on Microsoft server 2016 and later" {
67-
Mock -ModuleName BOSH.CFCell Install-CFFeatures2012 { }
68-
Mock -ModuleName BOSH.CFCell Install-CFFeatures2016 { }
69-
Mock -ModuleName BOSH.CFCell Write-Error { }
70-
Mock -ModuleName BOSH.CFCell Get-OSVersionString { "10.0.1803" }
71-
72-
{ Install-CFFeatures } | Should -Not -Throw
73-
74-
Assert-MockCalled Install-CFFeatures2016 -Times 1 -Scope It -ModuleName BOSH.CFCell -ParameterFilter { $ForceReboot }
75-
Assert-MockCalled Install-CFFeatures2012 -Times 0 -Scope It -ModuleName BOSH.CFCell
76-
}
77-
}
78-
79-
Describe "Install-CFFeatures2016" {
8066
BeforeEach {
8167
Mock -ModuleName BOSH.CFCell Write-Log { }
8268
Mock -ModuleName BOSH.CFCell Get-WinRMConfig { "Some config" }
@@ -89,25 +75,25 @@ Describe "Install-CFFeatures2016" {
8975
}
9076

9177
It "triggers a machine restart when the -ForceReboot flag is set" {
92-
{ Install-CFFeatures2016 -ForceReboot } | Should -Not -Throw
78+
{ Install-CFFeatures -ForceReboot } | Should -Not -Throw
9379

9480
Assert-MockCalled Restart-Computer -Times 1 -Scope It -ModuleName BOSH.CFCell
9581
}
9682

9783
It "doesn't trigger a machine restart if -ForceReboot flag not set" {
98-
{ Install-CFFeatures2016 } | Should -Not -Throw
84+
{ Install-CFFeatures } | Should -Not -Throw
9985

10086
Assert-MockCalled Restart-Computer -Times 0 -Scope It -ModuleName BOSH.CFCell
10187
}
10288

10389
It "logs Installing CloudFoundry Cell Windows Features" {
104-
{ Install-CFFeatures2016 } | Should -Not -Throw
90+
{ Install-CFFeatures } | Should -Not -Throw
10591

10692
Assert-MockCalled Write-Log -Times 1 -Scope It -ModuleName BOSH.CFCell -ParameterFilter { $Message -eq "Installing CloudFoundry Cell Windows Features" }
10793
}
10894

10995
It "logs Installed CloudFoundry Cell Windows Features after installation" {
110-
{ Install-CFFeatures2016 } | Should -Not -Throw
96+
{ Install-CFFeatures } | Should -Not -Throw
11197

11298
Assert-MockCalled Write-Log -Times 1 -Scope It -ModuleName BOSH.CFCell -ParameterFilter { $Message -eq "Installed CloudFoundry Cell Windows Features" }
11399
}

modules/BOSH.CFCell/BOSH.CFCell.psd1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ PowerShellVersion = '4.0'
99
RequiredModules = @('BOSH.Utils')
1010
FunctionsToExport = @('disable-service',
1111
'Install-CFFeatures',
12-
'Install-CFFeatures2012',
13-
'Install-CFFeatures2016',
1412
'Remove-DockerPackage',
1513
'Protect-CFCell')
1614
CmdletsToExport = @()

modules/BOSH.CFCell/BOSH.CFCell.psm1

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,10 @@
11
<#
22
.Synopsis
3-
Install CloudFoundry Cell components for either 2012R2 or 2016
3+
Install Windows CloudFoundry Cell components
44
.Description
5-
This cmdlet installs the minimum set of features for a CloudFoundry Cell on Windows 2012R2 or Windows 2016
5+
This cmdlet installs the minimum set of features for a CloudFoundry Cell on Windows
66
#>
77
function Install-CFFeatures {
8-
$VERSION = Get-OSVersionString
9-
switch -Wildcard ($VERSION) {
10-
"6.3.*" {
11-
Install-CFFeatures2012
12-
}
13-
"10.0.*" {
14-
Install-CFFeatures2016 -ForceReboot
15-
}
16-
default {
17-
Write-Error "Unsupported Windows version $($VERSION)"
18-
}
19-
}
20-
}
21-
22-
<#
23-
.Synopsis
24-
Install Windows 2012 CloudFoundry Cell components
25-
.Description
26-
This cmdlet installs the minimum set of features for a CloudFoundry Cell on Windows 2012R2
27-
#>
28-
function Install-CFFeatures2012 {
29-
Write-Log "Getting WinRM config"
30-
$winrm_config = Get-WinRMConfig
31-
Write-Log "$winrm_config"
32-
33-
Write-Log "Installing CloudFoundry Cell Windows 2012 Features"
34-
$ErrorActionPreference = "Stop";
35-
trap { $host.SetShouldExit(1) }
36-
37-
WindowsFeatureInstall("Web-Webserver")
38-
WindowsFeatureInstall("Web-WebSockets")
39-
WindowsFeatureInstall("AS-Web-Support")
40-
WindowsFeatureInstall("AS-NET-Framework")
41-
WindowsFeatureInstall("Web-WHC")
42-
WindowsFeatureInstall("Web-ASP")
43-
44-
Write-Log "Installed CloudFoundry Cell Windows 2012 Features"
45-
}
46-
47-
<#
48-
.Synopsis
49-
Install Windows 2016 CloudFoundry Cell components
50-
.Description
51-
This cmdlet installs the minimum set of features for a CloudFoundry Cell on Windows 2016
52-
#>
53-
function Install-CFFeatures2016 {
548
param([switch]$ForceReboot)
559

5610
Write-Log "Getting WinRM config"
@@ -75,7 +29,7 @@ function Install-CFFeatures2016 {
7529
}
7630
}
7731

78-
function Wait-ForNewIfaces() {
32+
function Wait-ForNewIfaces {
7933
param([string]$ifaces)
8034
$max = 20
8135
$try = 0
@@ -175,21 +129,21 @@ function set-firewall {
175129
}
176130

177131
function get-firewall {
178-
param([string] $profile)
132+
param([string] $profileName)
179133

180-
$firewall = (Get-NetFirewallProfile -Name $profile)
181-
$result = "{0},{1},{2}" -f $profile,$firewall.DefaultInboundAction,$firewall.DefaultOutboundAction
134+
$firewall = (Get-NetFirewallProfile -Name $profileName)
135+
$result = "{0},{1},{2}" -f $profileName,$firewall.DefaultInboundAction,$firewall.DefaultOutboundAction
182136
return $result
183137
}
184138

185139
function check-firewall {
186-
param([string] $profile)
140+
param([string] $profileName)
187141

188-
$firewall = (get-firewall $profile)
142+
$firewall = (get-firewall $profileName)
189143
Write-Log $firewall
190-
if ($firewall -ne "$profile,Block,Allow") {
144+
if ($firewall -ne "$profileName,Block,Allow") {
191145
Write-Log $firewall
192-
Throw "Unable to set $profile Profile"
146+
Throw "Unable to set $profileName Profile"
193147
}
194148
}
195149

modules/BOSH.Sysprep/BOSH.Sysprep.Tests.ps1

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,13 @@ Describe "Remove-UserAccounts" {
219219
Describe "Invoke-Sysprep" {
220220
Context "when not provided an IaaS" {
221221
It "throws" {
222-
{ Invoke-Sysprep -OsVersion "windows2012R2" } | Should -Throw "Provide the IaaS this stemcell will be used for"
222+
{ Invoke-Sysprep -OsVersion "windows2019" } | Should -Throw "Provide the IaaS this stemcell will be used for"
223223
}
224224
}
225225

226226
Context "when provided an invalid Iaas" {
227227
It "throws" {
228-
{ Invoke-Sysprep -IaaS "OpenShift" -SkipLGPO -OsVersion "windows2012R2" } | Should -Throw "Invalid IaaS 'OpenShift' supported platforms are: AWS, Azure, GCP and Vsphere"
228+
{ Invoke-Sysprep -IaaS "OpenShift" -SkipLGPO -OsVersion "windows2019" } | Should -Throw "Invalid IaaS 'OpenShift' supported platforms are: AWS, Azure, GCP and Vsphere"
229229
}
230230
}
231231

@@ -258,32 +258,6 @@ Describe "Invoke-Sysprep" {
258258
}
259259

260260
Context "for AWS" {
261-
It "handles Windows 1709" {
262-
Mock Get-OSVersion { "windows2016" } -ModuleName BOSH.Sysprep
263-
264-
{ Invoke-Sysprep -Iaas "aws" } | Should -Not -Throw
265-
266-
Assert-MockCalled Update-AWS2016Config -Times 1 -Scope It -ModuleName BOSH.Sysprep
267-
Assert-MockCalled Enable-AWS2016Sysprep -Times 1 -Scope It -ModuleName BOSH.Sysprep
268-
269-
Assert-MockCalled Get-OSVersion -Times 1 -Scope It -ModuleName BOSH.Sysprep
270-
271-
Assert-MockCalled Start-Process -Times 0 -Scope It -ParameterFilter { $FilePath -eq "C:\Program Files\Amazon\Ec2ConfigService\Ec2Config.exe" -and $ArgumentList -eq "-sysprep" } -ModuleName BOSH.Sysprep
272-
}
273-
274-
It "handles Windows 1803" {
275-
Mock Get-OSVersion { "windows1803" } -ModuleName Bosh.Sysprep
276-
277-
{ Invoke-Sysprep -Iaas "aws" } | Should -Not -Throw
278-
279-
Assert-MockCalled Update-AWS2016Config -Times 1 -Scope It -ModuleName BOSH.Sysprep
280-
Assert-MockCalled Enable-AWS2016Sysprep -Times 1 -Scope It -ModuleName BOSH.Sysprep
281-
282-
Assert-MockCalled Get-OSVersion -Times 1 -Scope It -ModuleName BOSH.Sysprep
283-
284-
Assert-MockCalled Start-Process -Times 0 -Scope It -ParameterFilter { $FilePath -eq "C:\Program Files\Amazon\Ec2ConfigService\Ec2Config.exe" -and $ArgumentList -eq "-sysprep" } -ModuleName BOSH.Sysprep
285-
}
286-
287261
It "handles other OS'" {
288262
Mock Get-OSVersion { Throw "invalid OS detected" } -ModuleName Bosh.Sysprep
289263

@@ -342,30 +316,6 @@ Describe "Invoke-Sysprep" {
342316
Context "for LGPO" {
343317
# We use AWS as the IaaS as it is the only IaaS that is fully mocked right now
344318
# We don't want to trigger Sysprep during our test
345-
It "handles Windows 2012R2" {
346-
Mock Get-OSVersion { "windows2012R2" } -ModuleName Bosh.Sysprep
347-
$ExpectedPath = Join-Path $PSScriptRoot "cis-merge-2012R2"
348-
{ Invoke-Sysprep -Iaas "aws" } | Should -Not -Throw
349-
350-
Assert-MockCalled Enable-LocalSecurityPolicy -ParameterFilter { $PolicySource -eq $ExpectedPath } -Times 1 -Scope It -ModuleName BOSH.Sysprep
351-
}
352-
353-
It "handles Windows 1709" {
354-
Mock Get-OSVersion { "windows2016" } -ModuleName Bosh.Sysprep
355-
356-
{ Invoke-Sysprep -Iaas "aws" } | Should -Not -Throw
357-
358-
Assert-MockCalled Enable-LocalSecurityPolicy -Times 0 -Scope It -ModuleName BOSH.Sysprep
359-
}
360-
361-
It "handles Windows 1803" {
362-
Mock Get-OSVersion { "windows1803" } -ModuleName Bosh.Sysprep
363-
$ExpectedPath = Join-Path $PSScriptRoot "cis-merge-1803"
364-
{ Invoke-Sysprep -Iaas "aws" } | Should -Not -Throw
365-
366-
Assert-MockCalled Enable-LocalSecurityPolicy -ParameterFilter { $PolicySource -eq $ExpectedPath } -Times 1 -Scope It -ModuleName BOSH.Sysprep
367-
}
368-
369319
It "handles Windows 2019" {
370320
Mock Get-OSVersion { "windows2019" } -ModuleName Bosh.Sysprep
371321
$ExpectedPath = Join-Path $PSScriptRoot "cis-merge-2019"
@@ -375,7 +325,7 @@ Describe "Invoke-Sysprep" {
375325
}
376326

377327
It "skips local policy update if -SkipLGPO is set" {
378-
Mock Get-OSVersion { "windows2012R2" } -ModuleName Bosh.Sysprep
328+
Mock Get-OSVersion { "windows2019" } -ModuleName Bosh.Sysprep
379329

380330
{ Invoke-Sysprep -Iaas "aws" -SkipLGPO } | Should -Not -Throw
381331

0 commit comments

Comments
 (0)