github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/pkg/inspector/check/docker.go (about)

     1  package check
     2  
     3  import (
     4  	"fmt"
     5  	"os/exec"
     6  )
     7  
     8  // DockerInPathCheck returns true if the docker binary is on the executable path
     9  // The check only runs when InstallationDisabled is true and the binary should already be insalled
    10  type DockerInPathCheck struct {
    11  	InstallationDisabled bool
    12  }
    13  
    14  func (c DockerInPathCheck) Check() (bool, error) {
    15  	if c.InstallationDisabled {
    16  		cmd := exec.Command("bash", "-c", fmt.Sprintf("command -v %s", "docker"))
    17  		if err := cmd.Run(); err != nil {
    18  			return false, nil
    19  		}
    20  	}
    21  	return true, nil
    22  }