Skip deleting leftovers if bin not available
Avoids spamming the log with extra driverspull/7959/head
parent
c1be17346b
commit
9673b421df
|
@ -168,6 +168,7 @@ func runDelete(cmd *cobra.Command, args []string) {
|
|||
if orphan {
|
||||
// TODO: generalize for non-KIC drivers: #8040
|
||||
deletePossibleKicLeftOver(cname, driver.Docker)
|
||||
deletePossibleKicLeftOver(cname, driver.Podman)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,8 +211,6 @@ func DeleteProfiles(profiles []*config.Profile) []error {
|
|||
|
||||
// TODO: remove and/or move to delete package: #8040
|
||||
func deletePossibleKicLeftOver(cname string, driverName string) {
|
||||
glog.Infof("deleting possible KIC leftovers for %s (driver=%s) ...", cname, driverName)
|
||||
|
||||
bin := ""
|
||||
switch driverName {
|
||||
case driver.Docker:
|
||||
|
@ -222,6 +221,13 @@ func deletePossibleKicLeftOver(cname string, driverName string) {
|
|||
return
|
||||
}
|
||||
|
||||
if _, err := exec.LookPath(bin); err != nil {
|
||||
glog.Infof("skipping deletePossibleKicLeftOver for %s: %v", bin, err)
|
||||
return
|
||||
}
|
||||
|
||||
glog.Infof("deleting possible KIC leftovers for %s (driver=%s) ...", cname, driverName)
|
||||
|
||||
delLabel := fmt.Sprintf("%s=%s", oci.ProfileLabelKey, cname)
|
||||
cs, err := oci.ListContainersByLabel(bin, delLabel)
|
||||
if err == nil && len(cs) > 0 {
|
||||
|
|
Loading…
Reference in New Issue