check cluster is running

pull/15868/head
Steven Powell 2023-07-13 10:09:08 -07:00
parent 06fb28c2c3
commit 2792c9b9c9
1 changed files with 10 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import (
"time"
"github.com/blang/semver/v4"
"github.com/docker/machine/libmachine/state"
"github.com/pkg/errors"
"github.com/spf13/viper"
@ -613,6 +614,15 @@ func VerifyNotPaused(profile string, enable bool) error {
return errors.Wrap(err, "get host")
}
s, err := host.Driver.GetState()
if err != nil {
return errors.Wrap(err, "get state")
}
if s != state.Running {
// can't check the status of pods on a non-running cluster
return nil
}
runner, err := machine.CommandRunner(host)
if err != nil {
return errors.Wrap(err, "command runner")