mirror of https://github.com/kubernetes/kops.git
Prefer exitWithError to os.Exit
This commit is contained in:
parent
e1a4d6e609
commit
bf99d6b381
|
@ -47,7 +47,7 @@ func init() {
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := createCluster.Run(args)
|
||||
if err != nil {
|
||||
glog.Exitf("%v", err)
|
||||
exitWithError("%v", err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -209,8 +209,7 @@ func (c *CreateClusterCmd) Run(args []string) error {
|
|||
}
|
||||
} else {
|
||||
// This is hard, because of the etcd cluster
|
||||
glog.Errorf("Cannot change master-zones from the CLI")
|
||||
os.Exit(1)
|
||||
return fmt.Errorf("Cannot change master-zones from the CLI")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,8 +297,7 @@ func (c *CreateClusterCmd) Run(args []string) error {
|
|||
}
|
||||
|
||||
if cluster.SharedVPC() && cluster.Spec.NetworkCIDR == "" {
|
||||
glog.Errorf("Must specify NetworkCIDR when VPC is set")
|
||||
os.Exit(1)
|
||||
return fmt.Errorf("Must specify NetworkCIDR when VPC is set")
|
||||
}
|
||||
|
||||
if cluster.Spec.CloudProvider == "" {
|
||||
|
|
|
@ -24,8 +24,7 @@ func init() {
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
err := exportKubecfgCommand.Run(args)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
exitWithError(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ It allows you to create, destroy, upgrade and maintain clusters.`,
|
|||
func Execute() {
|
||||
goflag.CommandLine.Parse([]string{})
|
||||
if err := rootCommand.cobraCommand.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(-1)
|
||||
exitWithError(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue