From dcd5858893a8fb0887036b2fe05664bdde7077c0 Mon Sep 17 00:00:00 2001 From: Shaun Davis Date: Mon, 8 Jul 2024 14:43:24 -0500 Subject: [PATCH] Ensure credentials are written before performing restore --- internal/flypg/node.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/flypg/node.go b/internal/flypg/node.go index f309092a..c3d28e0c 100644 --- a/internal/flypg/node.go +++ b/internal/flypg/node.go @@ -133,11 +133,6 @@ func (n *Node) Init(ctx context.Context) error { return fmt.Errorf("failed initialize cluster state store: %s", err) } - // Determine if we are performing a remote restore. - if err := n.handleRemoteRestore(ctx, store); err != nil { - return fmt.Errorf("failed to handle remote restore: %s", err) - } - // Ensure we have the required s3 credentials set. if os.Getenv("S3_ARCHIVE_CONFIG") != "" || os.Getenv("S3_ARCHIVE_REMOTE_RESTORE_CONFIG") != "" { if err := writeS3Credentials(ctx, s3AuthDir); err != nil { @@ -145,6 +140,11 @@ func (n *Node) Init(ctx context.Context) error { } } + // Determine if we are performing a remote restore. + if err := n.handleRemoteRestore(ctx, store); err != nil { + return fmt.Errorf("failed to handle remote restore: %s", err) + } + // Verify whether we are a booting zombie. if ZombieLockExists() { if err := handleZombieLock(ctx, n); err != nil {