Skip to content

Commit

Permalink
Merge pull request #7020 from medyagh/sudo_systmctl
Browse files Browse the repository at this point in the history
using sudo for all systemctl calls
  • Loading branch information
medyagh authored Mar 12, 2020
2 parents cad9e7a + 4ce5a16 commit 54e997e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hack/jenkins/linux_integration_tests_none.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/cruntime/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/cruntime/crio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/cruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 54e997e

Please sign in to comment.