MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / NewCmd

Function NewCmd

internal/cmd/manager/bootstrap/cmd.go:34–64  ·  view source on GitHub ↗

NewCmd create a new cobra command

()

Source from the content-addressed store, hash-verified

32
33// NewCmd create a new cobra command
34func NewCmd() *cobra.Command {
35 cmd := cobra.Command{
36 Use: "bootstrap [target]",
37 Args: cobra.ExactArgs(1),
38 RunE: func(cmd *cobra.Command, args []string) error {
39 contextLogger := log.FromContext(cmd.Context())
40 dest := args[0]
41
42 contextLogger.Info("Installing the manager executable",
43 "destination", dest,
44 "version", versions.Version,
45 "build", versions.Info)
46 err := fileutils.CopyFile(cmd.Root().Name(), dest)
47 if err != nil {
48 panic(err)
49 }
50
51 contextLogger.Info("Setting 0750 permissions")
52 err = os.Chmod(dest, 0o750) // #nosec
53 if err != nil {
54 panic(err)
55 }
56
57 contextLogger.Info("Bootstrap completed")
58
59 return nil
60 },
61 }
62
63 return &cmd
64}

Callers 1

mainFunction · 0.92

Calls 2

InfoMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected