Merge pull request #80017 from Pothulapati/removesys

Remove make-symlinks flag and corresponding code
This commit is contained in:
Kubernetes Prow Robot 2019-07-11 10:09:07 -07:00 committed by GitHub
commit 7e4a6ca3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}