Skip to content

Commit 6049ef1

Browse files
authored
Merge pull request #158 from arangodb-helper/bugfix/supervision-maintenance-mode
Bugfix/supervision maintenance mode
2 parents 0ac7bce + 2a2e389 commit 6049ef1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

service/upgrade_manager.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ func (m *upgradeManager) disableSupervision(ctx context.Context) error {
506506
err := api.ReadKey(ctx, superVisionStateKey, &value)
507507
if err != nil {
508508
m.log.Warningf("Failed to read supervision state: %v", err)
509-
} else if valueStr, ok := value.(string); !ok {
509+
} else if valueStr, ok := getMaintenanceMode(value); !ok {
510510
m.log.Warningf("Supervision state is not a string but: %v", value)
511511
} else if valueStr != superVisionStateMaintenance {
512512
m.log.Warningf("Supervision state is not yet '%s' but '%s'", superVisionStateMaintenance, valueStr)
@@ -522,6 +522,20 @@ func (m *upgradeManager) disableSupervision(ctx context.Context) error {
522522
}
523523
}
524524

525+
func getMaintenanceMode(value interface{}) (string, bool) {
526+
if s, ok := value.(string); ok {
527+
return s, true
528+
}
529+
if m, ok := value.(map[string]interface{}); ok {
530+
if mode, ok := m["Mode"]; ok {
531+
return getMaintenanceMode(mode)
532+
} else if mode, ok := m["mode"]; ok {
533+
return getMaintenanceMode(mode)
534+
}
535+
}
536+
return "", false
537+
}
538+
525539
// enableSupervision enabled supervision of the agency.
526540
func (m *upgradeManager) enableSupervision(ctx context.Context) error {
527541
api, err := m.createAgencyAPI()

0 commit comments

Comments
 (0)