Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic on stack select #3687

Merged
merged 1 commit into from
Dec 20, 2019
Merged

Conversation

chrsmith
Copy link
Contributor

A user was reporting a panic when running pulumi stack select. It was odd because the panic only happened when you get prompted and manually type in the stack name, but not when you run pulumi stack select xxx.

After more head scratching than I would like to admit, it boiled down to a new class of auth error on the Pulumi Service. (https://github.com/pulumi/pulumi-service/issues/4446) We return a stack xxx to the user, so it shows up in the list of available stacks to choose from. But when we actually go and get that stack (backend::Get) that returns (nil, nil) as is expected when the stack does not exist.

(Because of the specific way we are interpreting a 403 error we are getting from a 3rd party service, we are acting as if the stack doesn't exist at all.) And that's why we had the panic.

The meaningful part of this PR is just adding a new check for the case that backend::Get returns (nil, nil) and returning an appropriate error. Though until we fix the issue in the Pulumi Service, the user in this state will still see some confusing behavior. (Running pulumi stack select will show a stack in the list of stacks to choose from, but if you select it you get a "stack does not exist" error.)

But we'll just properly omit that from the list of stacks returned server-side. The CLI just needs to account for this corner case and not panic.

Fixes #3673

@chrsmith chrsmith added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Dec 18, 2019
Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrsmith chrsmith merged commit be84041 into master Dec 20, 2019
@pulumi-bot pulumi-bot deleted the chrsmith/3673/panic-on-stack-select branch December 20, 2019 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when running pulumi stack select
2 participants