diff options
author | John McCrae <john.mccrae@progress.com> | 2022-10-19 18:06:03 +0600 |
---|---|---|
committer | John McCrae <john.mccrae@progress.com> | 2022-10-20 16:34:53 +0600 |
commit | 8685182b56f9326973b3a0a02491dcae0a2825ad (patch) | |
tree | 5da0148e5b3f221995701a550ffef8d288186991 | |
parent | 795adfc773fb028f29dd55e7c5020ab8358df05b (diff) | |
download | chef-8685182b56f9326973b3a0a02491dcae0a2825ad.tar.gz |
Correcting for Hab not being installed
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r-- | .expeditor/scripts/ensure-minimum-viable-hab.ps1 | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 index 10bfeb0fa8..46deca3130 100644 --- a/.expeditor/scripts/ensure-minimum-viable-hab.ps1 +++ b/.expeditor/scripts/ensure-minimum-viable-hab.ps1 @@ -1,8 +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" - install-habitat --version 0.85.0.20190916 - 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" + 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')) } |