summaryrefslogtreecommitdiff
path: root/omnibus
diff options
context:
space:
mode:
authorJohn <john.mccrae@progress.com>2022-11-14 08:39:58 -0800
committerJohn <john.mccrae@progress.com>2022-11-14 08:39:58 -0800
commitf6247bc9637ac5da5bd7b2f8a13b09bb594c6128 (patch)
treea60557bbd76501e9f3602aec52754da8a7236247 /omnibus
parentac87b166b8e16ca7f1ff58982365400b73ef614a (diff)
downloadchef-f6247bc9637ac5da5bd7b2f8a13b09bb594c6128.tar.gz
updating the hab test to properly check for Windows PowerShell and set a TLS security value appropriately
Signed-off-by: John <john.mccrae@progress.com>
Diffstat (limited to 'omnibus')
-rw-r--r--omnibus/omnibus-test.ps112
1 files changed, 8 insertions, 4 deletions
diff --git a/omnibus/omnibus-test.ps1 b/omnibus/omnibus-test.ps1
index aac620f5de..019d981e0c 100644
--- a/omnibus/omnibus-test.ps1
+++ b/omnibus/omnibus-test.ps1
@@ -1,7 +1,7 @@
# Stop script execution when a non-terminating error occurs
$ErrorActionPreference = "Stop"
-# install chocolatey
+# install chocolatey
function installChoco {
if (!(Test-Path "$($env:ProgramData)\chocolatey\choco.exe")) {
@@ -13,12 +13,12 @@ function installChoco {
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
- catch {
+ catch {
Write-Error $_.Exception.Message
}
}
- else {
+ else {
Write-Output "Chocolatey is already installed"
}
}
@@ -26,7 +26,11 @@ function installChoco {
installChoco
# install powershell core
-Invoke-WebRequest "https://github.com/PowerShell/PowerShell/releases/download/v7.0.3/PowerShell-7.0.3-win-x64.msi" -UseBasicParsing -OutFile powershell.msi
+if ($PSVersionTable.PSVersion.Major -lt 7) {
+ $TLS12Protocol = [System.Net.SecurityProtocolType] 'Ssl3 , Tls12'
+ [System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol
+}
+Invoke-WebRequest "https://github.com/PowerShell/PowerShell/releases/download/v7.3.0/PowerShell-7.3.0-win-x64.msi" -UseBasicParsing -OutFile powershell.msi
Start-Process msiexec.exe -Wait -ArgumentList "/package PowerShell.msi /quiet"
$env:path += ";C:\Program Files\PowerShell\7"