Skip to content

Commit

Permalink
Merge pull request #2656 from stevekuznetsov/skuznets/nothing-to-delete
Browse files Browse the repository at this point in the history
podman: don't try to delete without volumes
  • Loading branch information
k8s-ci-robot authored Mar 5, 2022
2 parents 21d6d4d + 80f2185 commit 1e0b57b
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 1e0b57b

Please sign in to comment.