cmd

package
v3.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

cmd package contains all the command line flag and initialization logic for commands

Index

Constants

This section is empty.

Variables

View Source
var LocalCollectCmd = &cobra.Command{
	Use:   "local-collect",
	Short: "retrieves all the dremio logs and diagnostics for the local node and saves the results in a compatible format for Dremio support",
	Long:  `Retrieves all the dremio logs and diagnostics for the local node and saves the results in a compatible format for Dremio support. This subcommand needs to be run with enough permissions to read the /proc filesystem, the dremio logs and configuration files`,
	Run: func(cobraCmd *cobra.Command, args []string) {
		overrides := make(map[string]string)

		cobraCmd.Flags().Visit(func(flag *pflag.Flag) {
			if flag.Name == conf.KeyDremioPatToken {
				if flag.Value.String() == "" {
					pat, err := masking.PromptForPAT()
					if err != nil {
						fmt.Printf("unable to get PAT due to: %v\n", err)
						os.Exit(1)
					}
					overrides[flag.Name] = pat
				} else {
					overrides[flag.Name] = flag.Value.String()
				}

				simplelog.Debugf("overriding yaml with cli flag %v and value 'REDACTED'", flag.Name)
			} else {
				simplelog.Debugf("overriding yaml with cli flag %v and value %q", flag.Name, flag.Value.String())
				overrides[flag.Name] = flag.Value.String()
			}
		})
		if patStdIn {
			var inputReader io.Reader = cobraCmd.InOrStdin()
			b, err := io.ReadAll(inputReader)
			if err != nil {
				fmt.Printf("\nCRITICAL ERROR: %v\n", err)
				os.Exit(1)
			}
			pat := strings.TrimSpace(string(b[:]))
			if pat != "" {
				overrides[conf.KeyDremioPatToken] = pat
			}
		}
		msg, err := Execute(args, overrides)
		if err != nil {
			fmt.Printf("\nCRITICAL ERROR: %v\n", err)
			os.Exit(1)
		}
		fmt.Println(msg)
	},
}

Functions

func Execute

func Execute(args []string, overrides map[string]string) (string, error)

func RunTtopCollect

func RunTtopCollect(c *conf.CollectConf, hook shutdown.CancelHook) error

Types

This section is empty.

Directories

Path Synopsis
apicollect provides all the methods that collect via the API, this is a substantial part of the activities of DDC so it gets it's own package
apicollect provides all the methods that collect via the API, this is a substantial part of the activities of DDC so it gets it's own package
package conf provides configuration for the local-collect command
package conf provides configuration for the local-collect command
autodetect
package autodetect looks at the system configuration and file names and tries to guess at the correct configuration
package autodetect looks at the system configuration and file names and tries to guess at the correct configuration
ddcio include helper code for io operations common to ddc
ddcio include helper code for io operations common to ddc
package jvmcollect handles parsing of the jvm information
package jvmcollect handles parsing of the jvm information
package logcollect contains the logic for log collection in the local-collect sub command
package logcollect contains the logic for log collection in the local-collect sub command
main package is the entry point for the ddc local-collect binary
main package is the entry point for the ddc local-collect binary
package nodeinfocollect has all the methods for collecting the information for nodeinfo
package nodeinfocollect has all the methods for collecting the information for nodeinfo
queriesjson package contains the logic for collecting queries.json information
queriesjson package contains the logic for collecting queries.json information
threading package provides support for simple concurrency and threading
threading package provides support for simple concurrency and threading

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL