Skip to content

Commit 6272c40

Browse files
authored
fixes deprovision panic and recurring deployment doesn't exist error (#95)
Signed-off-by: Ashraf Fouda <ashraf.m.fouda@gmail.com>
1 parent 020c99a commit 6272c40

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

pkg/primitives/vm-light/vm.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,12 @@ func (p *Manager) Deprovision(ctx context.Context, wl *gridtypes.WorkloadWithID)
308308
log.Error().Err(err).Str("name", volName).Msg("failed to delete rootfs volume")
309309
}
310310

311-
tapName := wl.ID.Unique(string(cfg.Network.Mycelium.Network))
311+
if cfg.Network.Mycelium != nil {
312+
tapName := wl.ID.Unique(string(cfg.Network.Mycelium.Network))
312313

313-
if err := network.Detach(ctx, tapName); err != nil {
314-
return errors.Wrap(err, "could not clean up tap device")
314+
if err := network.Detach(ctx, tapName); err != nil {
315+
return errors.Wrap(err, "could not clean up tap device")
316+
}
315317
}
316318

317319
return nil

pkg/provision/engine.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,8 @@ func (e *NativeEngine) uninstallWorkload(ctx context.Context, wl *gridtypes.Work
680680
Logger()
681681

682682
_, err := e.storage.Current(twin, deployment, name)
683-
if errors.Is(err, ErrWorkloadNotExist) {
683+
if errors.Is(err, ErrWorkloadNotExist) || errors.Is(err, ErrDeploymentNotExists) {
684+
// workload or deployment doesn't exist in storage, consider it already deleted
684685
return nil
685686
} else if err != nil {
686687
return err

0 commit comments

Comments
 (0)