Merge pull request #930 from broady/master

pkg/minikube: fix uses of errors.Wrapf
pull/931/head
Matt Rickard 2016-12-15 23:25:46 -08:00 committed by GitHub
commit d1565d7d96
2 changed files with 7 additions and 7 deletions

View File

@ -91,10 +91,10 @@ func StartHost(api libmachine.API, config MachineConfig) (*host.Host, error) {
if s != state.Running {
if err := h.Driver.Start(); err != nil {
return nil, errors.Wrapf(err, "Error starting stopped host")
return nil, errors.Wrap(err, "Error starting stopped host")
}
if err := api.Save(h); err != nil {
return nil, errors.Wrapf(err, "Error saving started host")
return nil, errors.Wrap(err, "Error saving started host")
}
}
@ -133,7 +133,7 @@ func GetHostStatus(api libmachine.API) (string, error) {
dne := "Does Not Exist"
exists, err := api.Exists(constants.MachineName)
if err != nil {
return "", errors.Wrapf(err, "Error checking that api exists for: ", constants.MachineName)
return "", errors.Wrapf(err, "Error checking that api exists for: %s", constants.MachineName)
}
if !exists {
return dne, nil
@ -141,7 +141,7 @@ func GetHostStatus(api libmachine.API) (string, error) {
host, err := api.Load(constants.MachineName)
if err != nil {
return "", errors.Wrapf(err, "Error loading api for: ", constants.MachineName)
return "", errors.Wrapf(err, "Error loading api for: %s", constants.MachineName)
}
s, err := host.Driver.GetState()
@ -474,7 +474,7 @@ func GetHostLogs(api libmachine.API) (string, error) {
func CheckIfApiExistsAndLoad(api libmachine.API) (*host.Host, error) {
exists, err := api.Exists(constants.MachineName)
if err != nil {
return nil, errors.Wrapf(err, "Error checking that api exists for: ", constants.MachineName)
return nil, errors.Wrapf(err, "Error checking that api exists for: %s", constants.MachineName)
}
if !exists {
return nil, errors.Errorf("Machine does not exist for api.Exists(%s)", constants.MachineName)
@ -482,7 +482,7 @@ func CheckIfApiExistsAndLoad(api libmachine.API) (*host.Host, error) {
host, err := api.Load(constants.MachineName)
if err != nil {
return nil, errors.Wrapf(err, "Error loading api for: ", constants.MachineName)
return nil, errors.Wrapf(err, "Error loading api for: %s", constants.MachineName)
}
return host, nil
}

View File

@ -35,7 +35,7 @@ func ReadConfigOrNew(filename string) (*api.Config, error) {
if os.IsNotExist(err) {
return api.NewConfig(), nil
} else if err != nil {
return nil, errors.Wrapf(err, "Error reading file", filename)
return nil, errors.Wrapf(err, "Error reading file %q", filename)
}
// decode config, empty if no bytes