From 0833e4f6bf4e9fb33d6a824fb25c7c830160a544 Mon Sep 17 00:00:00 2001 From: Tarun Pothulapati Date: Thu, 11 Jul 2019 12:42:46 +0530 Subject: [PATCH] removed make-symlink flag and corresponding code in hyperkube Signed-off-by: Tarun Pothulapati --- cmd/hyperkube/main.go | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/cmd/hyperkube/main.go b/cmd/hyperkube/main.go index 3340e68e62a..d85c255ae20 100644 --- a/cmd/hyperkube/main.go +++ b/cmd/hyperkube/main.go @@ -20,12 +20,9 @@ limitations under the License. package main import ( - "errors" goflag "flag" - "fmt" "math/rand" "os" - "path" "path/filepath" "time" @@ -103,24 +100,17 @@ func NewHyperKubeCommand() (*cobra.Command, []func() *cobra.Command) { cloudController, } - makeSymlinksFlag := false cmd := &cobra.Command{ Use: "hyperkube", Short: "Request a new project", Run: func(cmd *cobra.Command, args []string) { - if len(args) != 0 || !makeSymlinksFlag { + if len(args) != 0 { cmd.Help() os.Exit(1) } - if err := makeSymlinks(os.Args[0], commandFns); err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err.Error()) - } }, } - cmd.Flags().BoolVar(&makeSymlinksFlag, "make-symlinks", makeSymlinksFlag, "create a symlink for each server in current directory") - cmd.Flags().MarkHidden("make-symlinks") // hide this flag from appearing in servers' usage output - cmd.Flags().MarkDeprecated("make-symlinks", "This feature will be removed in a later release.") for i := range commandFns { cmd.AddCommand(commandFns[i]()) @@ -128,28 +118,3 @@ func NewHyperKubeCommand() (*cobra.Command, []func() *cobra.Command) { return cmd, commandFns } - -// makeSymlinks will create a symlink for each command in the local directory. -func makeSymlinks(targetName string, commandFns []func() *cobra.Command) error { - wd, err := os.Getwd() - if err != nil { - return err - } - - var errs bool - for _, commandFn := range commandFns { - command := commandFn() - link := path.Join(wd, command.Name()) - - err := os.Symlink(targetName, link) - if err != nil { - errs = true - fmt.Println(err) - } - } - - if errs { - return errors.New("Error creating one or more symlinks") - } - return nil -}