Protect against panic when unprotecting state with no resources
Fixes: #4405
This commit is contained in:
parent
c04d1beaab
commit
b7a3d73f69
|
@ -6,6 +6,9 @@ CHANGELOG
|
|||
- Add support for a `PULUMI_CONSOLE_DOMAIN` environment variable to override the
|
||||
behavior for how URLs to the Pulumi Console are generated.
|
||||
[#4410](https://github.com/pulumi/pulumi/pull/4410)
|
||||
|
||||
- Protect against panic when unprotecting non-existant resources
|
||||
[#4441](https://github.com/pulumi/pulumi/pull/4441)
|
||||
|
||||
## 2.0.0 (2020-04-16)
|
||||
=======
|
||||
|
|
|
@ -68,6 +68,11 @@ This command clears the 'protect' bit on one or more resources, allowing those r
|
|||
|
||||
func unprotectAllResources(stackName string, showPrompt bool) result.Result {
|
||||
res := runTotalStateEdit(stackName, showPrompt, func(_ display.Options, snap *deploy.Snapshot) error {
|
||||
// Protects against Panic when a user tries to unprotect non-existing resources
|
||||
if snap == nil {
|
||||
return fmt.Errorf("no resources found to unprotect")
|
||||
}
|
||||
|
||||
for _, res := range snap.Resources {
|
||||
err := edit.UnprotectResource(snap, res)
|
||||
contract.AssertNoError(err)
|
||||
|
|
Loading…
Reference in a new issue