add error wrpaps for config set
parent
70402b4931
commit
e6d70210af
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package config
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
pkgConfig "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/exit"
|
||||
|
@ -51,28 +52,28 @@ func init() {
|
|||
func Set(name string, value string) error {
|
||||
s, err := findSetting(name)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "find settings for %q value of %q", name, value)
|
||||
}
|
||||
// Validate the new value
|
||||
err = run(name, value, s.validations)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "run validations for %q with value of %q", name, value)
|
||||
}
|
||||
|
||||
// Set the value
|
||||
config, err := pkgConfig.ReadConfig(localpath.ConfigFile)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "read config")
|
||||
}
|
||||
err = s.set(config, name, value)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "set")
|
||||
}
|
||||
|
||||
// Run any callbacks for this property
|
||||
err = run(name, value, s.callbacks)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrapf(err, "run callbacks for %q with value of %q", name, value)
|
||||
}
|
||||
|
||||
// Write the value
|
||||
|
|
Loading…
Reference in New Issue