bug: Ensure data source is ready during reset (#1310)

Signed-off-by: mudler <mudler@c3os.io>
This commit is contained in:
Ettore Di Giacinto
2023-04-17 17:27:37 +02:00
committed by Itxaka
parent 936b538cca
commit e5e595be4c

View File

@@ -64,6 +64,8 @@ func Reset(dir ...string) error {
lock.Lock() lock.Lock()
args := []string{"reset"} args := []string{"reset"}
ensureDataSourceReady()
bus.Manager.Publish(sdk.EventBeforeReset, sdk.EventPayload{}) //nolint:errcheck bus.Manager.Publish(sdk.EventBeforeReset, sdk.EventPayload{}) //nolint:errcheck
optsArgs := optsToArgs(options) optsArgs := optsToArgs(options)
@@ -96,7 +98,9 @@ func Reset(dir ...string) error {
bus.Manager.Publish(sdk.EventAfterReset, sdk.EventPayload{}) //nolint:errcheck bus.Manager.Publish(sdk.EventAfterReset, sdk.EventPayload{}) //nolint:errcheck
pterm.Info.Println("Rebooting in 60 seconds, press Enter to abort...") if !agentConfig.Fast {
pterm.Info.Println("Rebooting in 60 seconds, press Enter to abort...")
}
// We don't close the lock, as none of the following actions are expected to return // We don't close the lock, as none of the following actions are expected to return
lock2 := sync.Mutex{} lock2 := sync.Mutex{}