Skip to content

Commit

Permalink
added cleanup for docker containers in none driver
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-prindle committed Oct 2, 2017
1 parent 18de99b commit 10e6e6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 0 additions & 4 deletions hack/jenkins/linux_integration_tests_none.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,5 @@ EXTRA_BUILD_ARGS="$EXTRA_BUILD_ARGS --use-vendored-driver"
SUDO_PREFIX="sudo -E "
export KUBECONFIG="/root/.kube/config"

# Clean up running docker containers on the test slave
docker stop $(docker ps -aq) || true
docker rm $(docker ps -aq) || true

# Download files and set permissions
source common.sh
8 changes: 7 additions & 1 deletion pkg/drivers/none/none.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
)

const driverName = "none"
const dockerkillcmd = `docker rm $(docker kill $(docker ps -a --filter="name=k8s_" --format="{{.ID}}"))`
const dockerstopcmd = `docker stop $(docker ps -a --filter="name=k8s_" --format="{{.ID}}")`

// none Driver is a driver designed to run localkube w/o a VM
type Driver struct {
Expand Down Expand Up @@ -132,7 +134,10 @@ func (d *Driver) Remove() error {
cmd = exec.Command("sudo", "rm", "-rf", "/var/lib/localkube")
if err := cmd.Start(); err != nil {
return errors.Wrap(err, "removing localkube")

}
runCommand(dockerkillcmd, false)

return nil
}

Expand Down Expand Up @@ -160,7 +165,7 @@ else
sudo kill $(cat %s)
fi
`, constants.LocalkubePIDPath)
_, err := runCommand(stopcmd, true)
_, err := runCommand(stopcmd, false)
if err != nil {
return err
}
Expand All @@ -173,6 +178,7 @@ fi
break
}
}
runCommand(dockerstopcmd, false)
return nil
}

Expand Down

0 comments on commit 10e6e6a

Please sign in to comment.