Skip to content

Commit

Permalink
Handle upgrade components with no upgrade_mode property
Browse files Browse the repository at this point in the history
Edge components do not have this attribute and host components potentially could miss it as well.
The code should handle this case to avoid crash.

Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray committed Oct 8, 2024
1 parent 1d71c21 commit e75c2a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nsxt/resource_nsxt_upgrade_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,11 @@ func getPartialUpgradeMap(d *schema.ResourceData, targetVersion string) map[stri
for _, groupI := range d.Get(componentToGroupKey[component]).([]interface{}) {
group := groupI.(map[string]interface{})
enabled := group["enabled"].(bool)
upgradeMode := group["upgrade_mode"].(string)
upgradeMode := ""
um, ok := group["upgrade_mode"]
if ok {
upgradeMode = um.(string)
}
pauseAfterEach := group["pause_after_each_upgrade_unit"].(bool)
if !enabled || pauseAfterEach || upgradeMode == "stage_in_vlcm" {
isPartialUpgradeMap[component] = true
Expand Down

0 comments on commit e75c2a5

Please sign in to comment.