Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/cmd/cli/command/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ func makeStackRemoveCmd() *cobra.Command {
return fmt.Errorf("could not load stack parameters: %w", err)
}
provider := cli.NewProvider(ctx, stack.Provider, global.Client, stack.Name)
if !force {
// RemoveStack lists deployments through the provider, which needs credentials
if err := authenticateProvider(ctx, provider); err != nil {
return fmt.Errorf("%w; use --force to remove the stack without checking for active deployments", err)
}
}
return cli.RemoveStack(ctx, global.Client, provider, ec, projectName, name, force)
},
}
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/cli/client/byoc/scaleway/byoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,9 @@ func (b *ByocScaleway) CdCommand(ctx context.Context, req client.CdCommandReques

// CdList lists Pulumi stacks from the S3 state bucket.
func (b *ByocScaleway) CdList(ctx context.Context, _ bool) (iter.Seq[state.Info], error) {
if b.s3Client == nil {
return nil, errors.New("not authenticated; call Authenticate first")
Comment thread
lionello marked this conversation as resolved.
Resolved
}
bucket := b.bucketName()
prefix := ".pulumi/stacks/"

Expand Down
9 changes: 9 additions & 0 deletions src/pkg/cli/client/byoc/scaleway/byoc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,15 @@ func TestSubscribeRejectsMissingOrMismatchedRun(t *testing.T) {
require.ErrorIs(t, err, errors.ErrUnsupported)
}

func TestCdListRequiresAuth(t *testing.T) {
t.Parallel()

provider := newTestProvider("prod")
provider.s3Client = nil
_, err := provider.CdList(context.Background(), false)
require.EqualError(t, err, "not authenticated; call Authenticate first")
}

func TestAccountInfoRequiresAuthAndUsesClientContext(t *testing.T) {
t.Parallel()

Expand Down
Loading