Skip to content

Commit

Permalink
podman: don't try to delete without volumes
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
  • Loading branch information
stevekuznetsov committed Mar 4, 2022
1 parent 575a480 commit 80f2185
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cluster/internal/providers/podman/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ func (p *provider) DeleteNodes(n []nodes.Node) error {
}
nodeVolumes = append(nodeVolumes, volumes...)
}
if len(nodeVolumes) == 0 {
return nil
}
return deleteVolumes(nodeVolumes)
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/cluster/internal/providers/podman/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ func getVolumes(label string) ([]string, error) {
if err != nil {
return nil, err
}
if string(output) == "" {
// no volumes
return nil, nil
}
// Trim away the last `\n`.
trimmedOutput := strings.TrimSuffix(string(output), "\n")
// Get names of all volumes by splitting via `\n`.
Expand Down

0 comments on commit 80f2185

Please sign in to comment.