From de3dd0123e46c5711f88e3b06897704038211d20 Mon Sep 17 00:00:00 2001 From: twangboy Date: Thu, 13 Feb 2020 17:07:17 -0700 Subject: [PATCH] Add support for new version scheme --- bootstrap-salt.ps1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index cc443b7..3c311ec 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -77,11 +77,13 @@ Param( [Parameter(Mandatory=$false,ValueFromPipeline=$true)] # Doesn't support versions prior to "YYYY.M.R-B" - [ValidatePattern('^201\d\.\d{1,2}\.\d{1,2}(\-\d{1})?|(rc\d)$')] + # Supports new version and latest + # Option 1 means case insensitive + [ValidatePattern('^(\d{4}(\.\d{1,2}){0,2}(\-\d{1})?)|(latest)$', Options=1)] [string]$version = '', [Parameter(Mandatory=$false,ValueFromPipeline=$true)] - # Doesn't support versions prior to "2017.7.0" + # Doesn't support Python versions prior to "2017.7.0" [ValidateSet("2","3")] [string]$pythonVersion = "2", @@ -99,8 +101,8 @@ Param( [string]$repourl= "https://repo.saltstack.com/windows" ) -# Powershell supports only TLS 1.0 by default. Add support up to TLS 1.2 -[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12' +# Powershell supports only TLS 1.0 by default. Add support for TLS 1.2 +[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12' #=============================================================================== # Script Functions @@ -213,7 +215,7 @@ Else { #=============================================================================== # Use version "Latest" if no version is passed #=============================================================================== -If (!$version) { +If ((!$version) -or ($version.ToLower() -eq 'latest')){ $versionSection = "Latest-Py$pythonVersion" } else { $versionSection = $version