Skip to content

Commit

Permalink
delete network if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Ojea committed Aug 19, 2020
1 parent 3354f06 commit faed334
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cluster/internal/providers/podman/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ func createNetwork(name, subnet string) error {
name).Run()
}

// delete network if exists, otherwise do nothing
func deleteNetwork(name string) error {
networkName := fmt.Sprintf("%s-%s", fixedNetworkPrefix, name)
if err := exec.Command("podman", "network", "inspect", networkName); err != nil {
return nil
}
return exec.Command("podman", "network", "rm", networkName).Run()
}

Expand Down

0 comments on commit faed334

Please sign in to comment.