Skip to content

Commit cad98b0

Browse files
authored
Migration from generation branch (#21316)
1 parent d02818e commit cad98b0

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/Aks/Aks.Autorest/custom/Install-AzAksCliTool.ps1

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,28 @@ function Install-AzAksCliTool
120120
}
121121
}
122122

123+
function IsWindows {
124+
[Microsoft.Azure.PowerShell.Cmdlets.Aks.DoNotExportAttribute()]
125+
param(
126+
)
127+
process {
128+
return (Get-OSName).contains("Windows")
129+
}
130+
}
131+
132+
function Get-OSName {
133+
[Microsoft.Azure.PowerShell.Cmdlets.Aks.DoNotExportAttribute()]
134+
param(
135+
)
136+
process {
137+
if ($PSVersionTable.PSEdition.Contains("Core")) {
138+
$OSPlatform = $PSVersionTable.OS
139+
} else {
140+
$OSPlatform = $env:OS
141+
}
142+
return $OSPlatform
143+
}
144+
}
123145
Function Install-Kubectl
124146
{
125147
[Microsoft.Azure.PowerShell.Cmdlets.Aks.DoNotExportAttribute()]
@@ -163,7 +185,7 @@ Function Install-Kubectl
163185
$url = "$baseUrl/stable.txt"
164186
$Version = (Invoke-WebRequest -Uri $url).Content.Trim()
165187
}
166-
If ($IsWindows)
188+
If (IsWindows)
167189
{
168190
$destFilePath = [System.IO.Path]::Combine($Destination, "kubectl.exe")
169191
$downloadFileUrl = "$baseUrl/$Version/bin/windows/amd64/kubectl.exe"
@@ -258,7 +280,7 @@ Function Install-Kubelogin
258280
$Version = $latestVersionInfo.tag_name.Trim()
259281
}
260282
$downloadFileUrl = "$baseDownloadUrl/$Version/kubelogin.zip"
261-
If ($IsWindows)
283+
If (IsWindows)
262284
{
263285
$subDir = "windows_amd64"
264286
$binaryName = "kubelogin.exe"

src/Aks/Aks/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed the issue that system variable `$IsWindows` is undefined in `Windows PowerShell`.
2122
* Decoupled AutoMapper dependency, replaced with AdapterHelper.
2223

2324
## Version 5.3.1

0 commit comments

Comments
 (0)