Use LookPath to verify conntrack install

pull/7305/head
Thomas Stromberg 2020-03-28 13:19:48 -07:00
parent 1e7028634d
commit 1f31d25c16
1 changed files with 2 additions and 4 deletions

View File

@ -836,10 +836,8 @@ func validateFlags(cmd *cobra.Command, drvName string) {
// conntrack is required starting with kubernetes 1.18, include the release candidates for completion
version, _ := util.ParseKubernetesVersion(getKubernetesVersion(nil))
if version.GTE(semver.MustParse("1.18.0-beta.1")) {
err := exec.Command("conntrack").Run()
if err != nil {
exit.WithCodeT(exit.Config, "The none driver requires conntrack to be installed for kubernetes version {{.k8sVersion}}", out.V{"k8sVersion": version.String()})
if _, err := exec.LookPath("conntrack"); err != nil {
exit.WithCodeT(exit.Config, "Sorry, Kubernetes v{{.k8sVersion}} requires conntrack to be installed in root's path", out.V{"k8sVersion": version.String()})
}
}
}