Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigcheckCmd = &cli.Subcommand{ Use: "configcheck", Short: "check if config can be parsed without errors", SetupFlags: func(f *pflag.FlagSet) { f.StringVar(&configcheckArgs.format, "format", "", "dump parsed config object [pretty|yaml|json]") f.StringVar(&configcheckArgs.what, "what", "all", "what to print [all|config|jobs|logging]") f.BoolVar(&configcheckArgs.skipCertCheck, "skip-cert-check", false, "skip checking cert files") }, Run: func(ctx context.Context, subcommand *cli.Subcommand, args []string) error { formatMap := map[string]func(interface{}){ "": func(i interface{}) {}, "pretty": func(i interface{}) { if _, err := pretty.Println(i); err != nil { panic(err) } }, "json": func(i interface{}) { if err := json.NewEncoder(os.Stdout).Encode(subcommand.Config()); err != nil { panic(err) } }, "yaml": func(i interface{}) { if err := yaml.NewEncoder(os.Stdout).Encode(subcommand.Config()); err != nil { panic(err) } }, } formatter, ok := formatMap[configcheckArgs.format] if !ok { return fmt.Errorf("unsupported --format %q", configcheckArgs.format) } var hadErr bool parseFlags := config.ParseFlagsNone if configcheckArgs.skipCertCheck { parseFlags |= config.ParseFlagsNoCertCheck } confJobs, err := job.JobsFromConfig(subcommand.Config(), parseFlags) if err != nil { err := fmt.Errorf("cannot build jobs from config: %w", err) if configcheckArgs.what == "jobs" { return err } else { fmt.Fprintf(os.Stderr, "%s\n", err) confJobs = nil hadErr = true } } outlets, err := logging.OutletsFromConfig(subcommand.Config().Global.Logging) if err != nil { err := fmt.Errorf("cannot build logging from config: %w", err) if configcheckArgs.what == "logging" { return err } else { fmt.Fprintf(os.Stderr, "%s\n", err) outlets = nil hadErr = true } } whatMap := map[string]func(){ "all": func() { o := struct { config *config.Config jobs []job.Job logging *logger.Outlets }{ subcommand.Config(), confJobs, outlets, } formatter(o) }, "config": func() { formatter(subcommand.Config()) }, "jobs": func() { formatter(confJobs) }, "logging": func() { formatter(outlets) }, } wf, ok := whatMap[configcheckArgs.what] if !ok { return fmt.Errorf("unsupported --format %q", configcheckArgs.what) } wf() if hadErr { return errors.New("config parsing failed") } else { return nil } }, }
View Source
var MigrateCmd = &cli.Subcommand{ Use: "migrate", Short: "perform migration of the on-disk / zfs properties", SetupSubcommands: func() []*cli.Subcommand { return migrations }, }
View Source
var SignalCmd = &cli.Subcommand{ Use: "signal {stop | shutdown | wakeup JOB | reset JOB}", Short: "send a signal to the daemon", Long: `Send a signal to the daemon. Expected signals: stop Stop the daemon right now shutdown Stop the daemon gracefully wakeup Wake up a job from wait state reset Abort jobs current invocation `, SetupCobra: func(cmd *cobra.Command) { cmd.ValidArgs = []string{"stop", "shutdown", "wakeup", "reset"} cmd.Args = cobra.MatchAll(cobra.MinimumNArgs(1), func(cmd *cobra.Command, args []string) error { switch args[0] { case "stop", "shutdown": return cobra.ExactArgs(1)(cmd, args) case "wakeup", "reset": return cobra.ExactArgs(2)(cmd, args) } return cobra.OnlyValidArgs(cmd, args) }) }, Run: func(ctx context.Context, subcommand *cli.Subcommand, args []string, ) error { return runSignalCmd(subcommand.Config(), args) }, }
View Source
var StdinserverCmd = &cli.Subcommand{ Use: "stdinserver CLIENT_IDENTITY", Short: "stdinserver transport mode (started from authorized_keys file as forced command)", Run: func(ctx context.Context, subcommand *cli.Subcommand, args []string) error { return runStdinserver(subcommand.Config(), args) }, }
View Source
var TestCmd = &cli.Subcommand{ Use: "test", SetupSubcommands: func() []*cli.Subcommand { return []*cli.Subcommand{testFilter, testPlaceholder, testDecodeResumeToken} }, }
View Source
var VersionCmd = &cli.Subcommand{ Use: "version", Short: "print version of zrepl binary and running daemon", NoRequireConfig: true, SetupFlags: func(f *pflag.FlagSet) { f.StringVar(&versionArgs.Show, "show", "", "version info to show (client|daemon)") }, Run: func(ctx context.Context, subcommand *cli.Subcommand, args []string) error { versionArgs.Config = subcommand.Config() versionArgs.ConfigErr = subcommand.ConfigParsingError() return runVersionCmd() }, }
View Source
var ZFSAbstractionsCmd = &cli.Subcommand{ Use: "zfs-abstraction", Short: "manage abstractions that zrepl builds on top of ZFS", SetupSubcommands: func() []*cli.Subcommand { return []*cli.Subcommand{ zabsCmdList, zabsCmdReleaseAll, zabsCmdReleaseStale, zabsCmdCreate, } }, }
Functions ¶
This section is empty.
Types ¶
type AbstractionTypesFlag ¶
type AbstractionTypesFlag map[endpoint.AbstractionType]bool
func (AbstractionTypesFlag) FlagValue ¶
func (f AbstractionTypesFlag) FlagValue() map[endpoint.AbstractionType]bool
func (*AbstractionTypesFlag) Set ¶
func (f *AbstractionTypesFlag) Set(s string) error
func (AbstractionTypesFlag) String ¶
func (f AbstractionTypesFlag) String() string
func (AbstractionTypesFlag) Type ¶
func (f AbstractionTypesFlag) Type() string
type FilesystemsFilterFlag ¶
type FilesystemsFilterFlag struct {
F endpoint.ListZFSHoldsAndBookmarksQueryFilesystemFilter
}
func (FilesystemsFilterFlag) FlagValue ¶
func (flag FilesystemsFilterFlag) FlagValue() endpoint.ListZFSHoldsAndBookmarksQueryFilesystemFilter
func (*FilesystemsFilterFlag) Set ¶
func (flag *FilesystemsFilterFlag) Set(s string) error
func (FilesystemsFilterFlag) String ¶
func (flag FilesystemsFilterFlag) String() string
func (FilesystemsFilterFlag) Type ¶
func (flag FilesystemsFilterFlag) Type() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.