Browse Source

Work around Invoke-WebRequest hang without -UseBasicParsing

Douglas Thrift 5 years ago
parent
commit
71aaeee16c
2 changed files with 5 additions and 4 deletions
  1. 1 1
      automatic/right-st/update.ps1
  2. 4 3
      automatic/rsc/update.ps1

+ 1 - 1
automatic/right-st/update.ps1

@@ -3,7 +3,7 @@
 $latest_release = 'https://github.com/rightscale/right_st/releases/latest'
 
 function global:au_GetLatest {
-  $download_page = Invoke-WebRequest -Uri $latest_release
+  $download_page = Invoke-WebRequest -Uri $latest_release -UseBasicParsing
   $regex         = '^.+/v(\d+\.\d+\.\d+)/right_st-windows-amd64\.zip$'
   $url64         = $download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href
   $version       = $url64 -replace $regex, '$1'

+ 4 - 3
automatic/rsc/update.ps1

@@ -3,9 +3,10 @@
 $branches = 'https://github.com/rightscale/rsc/branches/all'
 
 function global:au_GetLatest {
-  $download_page = Invoke-WebRequest -Uri $branches
-  $regex         = '^v\d+\.\d+\.\d+$'
-  $branch        = $download_page.Links | ? innerText -Match $regex | select -First 1 -ExpandProperty innerText
+  $download_page = Invoke-WebRequest -Uri $branches -UseBasicParsing
+  $regex         = '^/rightscale/rsc/tree/(v\d+\.\d+\.\d+)$'
+  $tree          = $download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href
+  $branch        = $tree -replace $regex, '$1'
   $version       = $branch.Substring(1)
   $url64         = "https://binaries.rightscale.com/rsbin/rsc/$branch/rsc-windows-amd64.zip"
   return @{ Version = $version; URL64 = $url64 }