summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-10-19 17:14:23 +0600
committerJohn McCrae <john.mccrae@progress.com>2022-10-19 17:14:23 +0600
commit2307aa046224e367612459fee4a31fe66cbdea25 (patch)
tree97541f88cb0995845afe27b2483492f24477aee7
parent8d897072e40ed93ead7106683741ce2d5b06c2a1 (diff)
downloadchef-jfm/chef17_hab.tar.gz
Correcting for Hab not being installedjfm/chef17_hab
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--.expeditor/scripts/ensure-minimum-viable-hab.ps120
1 files changed, 14 insertions, 6 deletions
diff --git a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 b/.expeditor/scripts/ensure-minimum-viable-hab.ps1
index 716de60cf8..afa34ee45c 100644
--- a/.expeditor/scripts/ensure-minimum-viable-hab.ps1
+++ b/.expeditor/scripts/ensure-minimum-viable-hab.ps1
@@ -1,9 +1,17 @@
-[Version]$hab_version = (hab --version).split(" ")[1].split("/")[0]
-if ($hab_version -lt [Version]"0.85.0" ) {
+try {
+ [Version]$hab_version = (hab --version).split(" ")[1].split("/")[0]
+ if ($hab_version -lt [Version]"0.85.0" ) {
+ Write-Host "--- :habicat: Installing the version of Habitat required"
+ Set-ExecutionPolicy Bypass -Scope Process -Force
+ Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1'))
+ if (-not $?) { throw "Hab version is older than 0.85 and could not update it." }
+ } else {
+ Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed"
+ }
+}
+catch {
+ # This install fails if Hab isn't on the path when we check for the version. This ensures it is installed
Write-Host "--- :habicat: Installing the version of Habitat required"
Set-ExecutionPolicy Bypass -Scope Process -Force
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1'))
- if (-not $?) { throw "Hab version is older than 0.85 and could not update it." }
-} else {
- Write-Host "--- :habicat: :thumbsup: Minimum required version of Habitat already installed"
-}
+} \ No newline at end of file