Skip to content

Commit 9b828b1

Browse files
authored
fix issue comparing empty lb backend pool list to NIC backend pool list (#131)
1 parent 66d7ef9 commit 9b828b1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

AzureBasicLoadBalancerUpgrade/module/AzureBasicLoadBalancerUpgrade/AzureBasicLoadBalancerUpgrade.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'AzureBasicLoadBalancerUpgrade'
1313

1414
# Version number of this module.
15-
ModuleVersion = '2.4.14'
15+
ModuleVersion = '2.4.15'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -107,7 +107,7 @@
107107
# IconUri = ''
108108

109109
# ReleaseNotes of this module
110-
ReleaseNotes = 'Added support to retain AutomaticOSUpgrade setting when App Health extension is used instead of health probe.'
110+
ReleaseNotes = 'Fix bug when comparing backend pool membership on empty LBs.'
111111

112112
# Prerelease string of this module
113113
# Prerelease = 'beta'

AzureBasicLoadBalancerUpgrade/module/AzureBasicLoadBalancerUpgrade/modules/ValidateScenario/ValidateScenario.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,16 @@ Function Test-SupportedMigrationScenario {
407407
## compare nic backend pool memberships to basicLBBackendIds
408408
try {
409409
$nicBackendPoolMembershipsIds = @()
410+
410411
$nicBackendPoolMembershipsIds += $basicLBVMNics.IpConfigurations.loadBalancerBackendAddressPools.id | Sort-Object | Get-Unique
411-
$differentMembership = Compare-Object $nicBackendPoolMembershipsIds $basicLBBackendIds
412+
413+
If ([string]::IsNullOrEmpty($basicLBBackendIds)) {
414+
# handle LBs with no backend pools
415+
log -Message "[Test-SupportedMigrationScenario] No Basic Load Balancer backend pool IDs provided, so all NIC backend pool IDs must be on another LB (if any)." -Severity Debug
416+
}
417+
Else {
418+
$differentMembership = Compare-Object -ReferenceObject $nicBackendPoolMembershipsIds -DifferenceObject $basicLBBackendIds
419+
}
412420
}
413421
catch {
414422
$message = "[Test-SupportedMigrationScenario] Error comparing NIC backend pool memberships ($($nicBackendPoolMembershipsIds -join ',')) to basicLBBackendIds ($($basicLBBackendIds -join ',')). Error: $($_.Exception.Message)"

0 commit comments

Comments
 (0)