MCPcopy Create free account
hub / github.com/Scalingo/cli / waitFeatureUntilActivated

Function waitFeatureUntilActivated

db/features.go:57–79  ·  view source on GitHub ↗
(ctx context.Context, client *scalingo.Client, app, addon, feature string)

Source from the content-addressed store, hash-verified

55}
56
57func waitFeatureUntilActivated(ctx context.Context, client *scalingo.Client, app, addon, feature string) error {
58 ticker := time.NewTicker(3 * time.Second)
59 defer ticker.Stop()
60 for range ticker.C {
61 db, err := client.DatabaseShow(ctx, app, addon)
62 if err != nil {
63 return errors.Wrapf(ctx, err, "fail to refresh database metadata")
64 }
65 for _, f := range db.Features {
66 if f.Name == feature && f.Status != scalingo.DatabaseFeatureStatusPending {
67 switch f.Status {
68 case scalingo.DatabaseFeatureStatusActivated:
69 io.Statusf("Feature %v has been activated\n", feature)
70 return nil
71 case scalingo.DatabaseFeatureStatusFailed:
72 io.Warningf("Feature %v failed to get activated, please contact our support\n", feature)
73 return nil
74 }
75 }
76 }
77 }
78 return nil
79}
80
81// DisableFeature is the command handler to disable a database feature on a
82// database addon like 'force-ssl' or 'public-availability'

Callers 1

EnableFeatureFunction · 0.85

Calls 3

StatusfFunction · 0.92
WarningfFunction · 0.92
StopMethod · 0.80

Tested by

no test coverage detected