Skip to content

Commit a9c6123

Browse files
committed
add support for skipping volume clean-up via an env var
1 parent 774358b commit a9c6123

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

builder/openstack/step_create_volume.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package openstack
33
import (
44
"context"
55
"fmt"
6+
"os"
67

78
"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes"
89
"github.com/hashicorp/packer-plugin-sdk/multistep"
@@ -83,7 +84,9 @@ func (s *StepCreateVolume) Run(ctx context.Context, state multistep.StateBag) mu
8384
}
8485

8586
// Volume was created, so remember to clean it up.
86-
s.doCleanup = true
87+
if _, ok := os.LookupEnv("PACKER_SKIP_VOLUME_CLEANUP"); !ok {
88+
s.doCleanup = true
89+
}
8790

8891
// Set the Volume ID in the state.
8992
ui.Message(fmt.Sprintf("Volume ID: %s", volume.ID))

0 commit comments

Comments
 (0)