summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerard Braad <me@gbraad.nl>2022-08-04 14:56:54 +0800
committerAshley Cui <acui@redhat.com>2022-08-08 16:15:28 -0400
commit6beb3f208f408300fbafccd211f35d5d0c220751 (patch)
treecd2f7a67665fa713dcb6362b87930167fc8f1e4e
parenteab03100f790d27eb6dc66bcc251a65aea643d9c (diff)
downloadpodman-6beb3f208f408300fbafccd211f35d5d0c220751.tar.gz
podman-6beb3f208f408300fbafccd211f35d5d0c220751.tar.bz2
podman-6beb3f208f408300fbafccd211f35d5d0c220751.zip
Fixes #15154 Change order when config and connections are written
When the break out or the WSL environment fails to start, the config and connections should not be written. Placing them at the end of the provisioning step will mitigate the issue. [NO NEW TESTS NEEDED] Signed-off-by: Gerard Braad <me@gbraad.nl>
-rw-r--r--pkg/machine/wsl/machine.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/machine/wsl/machine.go b/pkg/machine/wsl/machine.go
index 9a57102f0..8f6ef7a43 100644
--- a/pkg/machine/wsl/machine.go
+++ b/pkg/machine/wsl/machine.go
@@ -364,14 +364,6 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
return false, err
}
- if err := v.writeConfig(); err != nil {
- return false, err
- }
-
- if err := setupConnections(v, opts, sshDir); err != nil {
- return false, err
- }
-
dist, err := provisionWSLDist(v)
if err != nil {
return false, err
@@ -393,6 +385,14 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) {
// Cycle so that user change goes into effect
_ = terminateDist(dist)
+ if err := v.writeConfig(); err != nil {
+ return false, err
+ }
+
+ if err := setupConnections(v, opts, sshDir); err != nil {
+ return false, err
+ }
+
return true, nil
}