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

Python Automation API returns CommandError Exception instead of the more specific ConcurrentUpdateError #11108

Closed
drf7 opened this issue Oct 21, 2022 · 4 comments · Fixed by #11146
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@drf7
Copy link

drf7 commented Oct 21, 2022

What happened?

When there is already an update in progress in a stack the exception thrown when trying another update is the generic exception CommandError instead of the more specific one ConcurrentUpdateError.

This is because the stderr from pulumi is error: the stack is currently locked by but the error defined in the pulumi code is [409] Conflict: Another update is currently in progress. here: https://github.com/pulumi/pulumi/blob/master/sdk/python/lib/pulumi/automation/errors.py#L70

So changing the line 70 from:
conflict_text = "[409] Conflict: Another update is currently in progress."
To:
conflict_text = "error: the stack is currently locked by"
Seems to fix this error for me.

Steps to reproduce

Execute a pulumi up in a stack that has already an update in progress using the python automation API

Expected Behavior

ConcurrentUpdateError exception is thrown

Actual Behavior

CommandError exception is thrown

Output of pulumi about

No response

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@drf7 drf7 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 21, 2022
@Zaid-Ajaj
Copy link
Contributor

Hi there @drf7 thanks a lot for reporting this issue and for the suggested fix 🙏 it looks like the conflict error we search for in stderr is not from the local backend so I've addressed this in #11146 such that this text also resolves to ConcurrentUpdateError and not the generic CommandError

@Zaid-Ajaj Zaid-Ajaj removed the needs-triage Needs attention from the triage team label Oct 25, 2022
@drf7
Copy link
Author

drf7 commented Oct 25, 2022

Hi @Zaid-Ajaj thanks for fixing it, by local backend you mean anything other than the self-hosted Pulumi Service? So if I were using the self-hosted Pulumi Service I wouldn't have run into this error?

@Zaid-Ajaj
Copy link
Contributor

Zaid-Ajaj commented Oct 26, 2022

@drf7 The local backend is when you use your local file system to store state. Pulumi supports multiple backends including our own Pulumi Service to store state. Unfortunately, regardless of which backend you use, there is still a chance you encounter a concurrent update error. There is an issue #9047 open to help improve the situation

@drf7
Copy link
Author

drf7 commented Oct 26, 2022

@Zaid-Ajaj I encounter this issue using local file system as backend but also using Azure Blob Storage as backend (so it is not only happening in the local file system as backend). But your PR should address both situations so everything is fine, just wanted to clarify that.

@bors bors bot closed this as completed in ed41404 Oct 26, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Oct 26, 2022
abhinav pushed a commit to pulumi/pulumi-dotnet that referenced this issue Jan 11, 2023
11146: [auto] detect concurrent update error from local backend r=Zaid-Ajaj a=Zaid-Ajaj

Fixes pulumi/pulumi#11108

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


11159: [dotnet] Simplify the format of docs comment of Output<T> r=Zaid-Ajaj a=Zaid-Ajaj

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes pulumi/pulumi#11120 because docfx cannot properly render ordered lists

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants