Skip to content

Commit

Permalink
update cluster and service logic
Browse files Browse the repository at this point in the history
  • Loading branch information
unloop committed Oct 22, 2018
1 parent 6b2bf68 commit 540348f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/cmd/cluster_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var ClusterAddCmd = &cobra.Command{
Short: "Add cluster",
Example: clusterAddExample,
Args: cobra.ExactArgs(2),
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, args []string) error {
local, _ := cmd.Flags().GetBool("local")
if !local {
return errors.New("method allowed with local flag")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmd/cluster_del.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var ClusterDelCmd = &cobra.Command{
Short: "Remove cluster",
Example: clusterDelExample,
Args: cobra.ExactArgs(1),
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, args []string) error {
local, _ := cmd.Flags().GetBool("local")
if !local {
return errors.New("method allowed with local flag")
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/cmd/cluster_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ var ClusterSelectCmd = &cobra.Command{
Use: "select [NAME]",
Short: "Select cluster",
Example: clusterSelectExample,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PreRunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return cmd.Help()
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {

name := args[0]

// Select local cluster
Expand Down
2 changes: 2 additions & 0 deletions pkg/cli/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var RootCmd = &cobra.Command{
var err error

cfg.Cluster = cmd.Flag("cluster").Value.String()

cfg.Debug, err = cmd.Flags().GetBool("debug")
if err != nil {
panic("Invalid debug flag")
Expand All @@ -83,6 +84,7 @@ var RootCmd = &cobra.Command{
if err != nil {
panic("Invalid tls flag")
}

if tls {
config.TLS.Insecure = false
config.TLS.CAFile = cmd.Flag("tlscacert").Value.String()
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ func GetCluster() (*Cluster, error) {
return nil, err
}

return nil, nil
return res, nil
}

0 comments on commit 540348f

Please sign in to comment.