Handle possible strict mode bugs (#4106)

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2022-11-10 16:48:56 -05:00 committed by GitHub
parent 4dace9b114
commit 6426e9d901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,7 @@ function Login([string]$subscription, [string]$clusterGroup, [switch]$pushImages
$kubeContext = (RunOrExitOnFailure kubectl config view -o json) | ConvertFrom-Json -AsHashtable
$defaultNamespace = $null
$targetContext = $kubeContext.contexts.Where({ $_.name -eq $clusterName }) | Select -First 1
if ($targetContext -ne $null) {
if ($targetContext -ne $null -and $targetContext.PSObject.Properties.Name -match "namespace") {
$defaultNamespace = $targetContext.context.namespace
}