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