Merge pull request #7020 from medyagh/sudo_systmctl

using sudo for all systemctl calls
pull/7022/head
Medya Ghazizadeh 2020-03-12 13:29:10 -07:00 committed by GitHub
commit 54e997e5cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ sudo rm -rf /etc/kubernetes/*
sudo rm -rf /var/lib/minikube/*
# Stop any leftover kubelet
systemctl is-active --quiet kubelet \
sudo systemctl is-active --quiet kubelet \
&& echo "stopping kubelet" \
&& sudo systemctl stop kubelet

View File

@ -157,7 +157,7 @@ func (r *Containerd) DefaultCNI() bool {
// Active returns if containerd is active on the host
func (r *Containerd) Active() bool {
c := exec.Command("systemctl", "is-active", "--quiet", "service", "containerd")
c := exec.Command("sudo", "systemctl", "is-active", "--quiet", "service", "containerd")
_, err := r.Runner.RunCmd(c)
return err == nil
}

View File

@ -103,7 +103,7 @@ func (r *CRIO) Available() error {
// Active returns if CRIO is active on the host
func (r *CRIO) Active() bool {
c := exec.Command("systemctl", "is-active", "--quiet", "service", "crio")
c := exec.Command("sudo", "systemctl", "is-active", "--quiet", "service", "crio")
_, err := r.Runner.RunCmd(c)
return err == nil
}

View File

@ -95,7 +95,7 @@ func (r *Docker) Available() error {
// Active returns if docker is active on the host
func (r *Docker) Active() bool {
c := exec.Command("systemctl", "is-active", "--quiet", "service", "docker")
c := exec.Command("sudo", "systemctl", "is-active", "--quiet", "service", "docker")
_, err := r.Runner.RunCmd(c)
return err == nil
}

View File

@ -77,7 +77,7 @@ func Restart(cr command.Runner) error {
// Check checks on the status of the kubelet
func Check(cr command.Runner) error {
glog.Infof("checking for running kubelet ...")
c := exec.Command("systemctl", "is-active", "--quiet", "service", "kubelet")
c := exec.Command("sudo", "systemctl", "is-active", "--quiet", "service", "kubelet")
if _, err := cr.RunCmd(c); err != nil {
return errors.Wrap(err, "check kubelet")
}