Only check packer version if not VagrantOnly

This commit is contained in:
Jared Haight
2018-03-31 12:41:59 -07:00
parent 235dd00cbe
commit 3be47e70c8

View File

@@ -217,6 +217,16 @@ function preflight_checks {
if (-Not ($VagrantOnly)) { if (-Not ($VagrantOnly)) {
Write-Verbose '[preflight_checks] Checking if packer is installed' Write-Verbose '[preflight_checks] Checking if packer is installed'
check_packer check_packer
# Check Packer Version against known bad
Write-Verbose '[preflight_checks] Checking for bad packer version..'
[System.Version]$PackerVersion = $(& $PackerPath "--version")
[System.Version]$PackerKnownBad = 1.1.2
if ($PackerVersion -eq $PackerKnownBad) {
Write-Error 'Packer 1.1.2 is not supported. Please upgrade to a newer version and see https://github.com/hashicorp/packer/issues/5622 for more information.'
break
}
} }
Write-Verbose '[preflight_checks] Checking if vagrant is installed' Write-Verbose '[preflight_checks] Checking if vagrant is installed'
check_vagrant check_vagrant
@@ -256,16 +266,6 @@ function preflight_checks {
Write-Output "You can safely ignore this warning if you are deploying DetectionLab to a different drive." Write-Output "You can safely ignore this warning if you are deploying DetectionLab to a different drive."
} }
# Check Packer Version against known bad
Write-Verbose '[preflight_checks] Checking for bad packer version..'
[System.Version]$PackerVersion = $(& $PackerPath "--version")
[System.Version]$PackerKnownBad = 1.1.2
if ($PackerVersion -eq $PackerKnownBad) {
Write-Error 'Packer 1.1.2 is not supported. Please upgrade to a newer version and see https://github.com/hashicorp/packer/issues/5622 for more information.'
break
}
# Ensure the vagrant-reload plugin is installed # Ensure the vagrant-reload plugin is installed
Write-Verbose '[preflight_checks] Checking if vagrant-reload is installed..' Write-Verbose '[preflight_checks] Checking if vagrant-reload is installed..'
if (-Not (vagrant plugin list | Select-String 'vagrant-reload')) { if (-Not (vagrant plugin list | Select-String 'vagrant-reload')) {