Skip to content

Commit

Permalink
Sync from server repo (37beae0785c9)
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoYang0000 committed Sep 11, 2024
1 parent 13e80a7 commit ad8f71c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
16 changes: 7 additions & 9 deletions commands/cmd_create_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func (c *CmdCreateArchive) setLocalFlags(cmd *cobra.Command) {
"The name of archive to be created.",
)
cmd.Flags().IntVar(
&c.createArchiveOptions.NumOfArchives,
&c.createArchiveOptions.NumRestorePoint,
"num-restore-points",
vclusterops.CreateArchiveDefaultNumRestore,
"Maximum number of restore points that archive can contain."+
"If you provide 0, the number of restore points will be unlimited. "+
"By default, the value is 0.",
"By default, the value is 0. Negative number is disallowed.",
)
cmd.Flags().StringVar(
&c.createArchiveOptions.Sandbox,
Expand Down Expand Up @@ -122,8 +122,6 @@ func (c *CmdCreateArchive) Parse(inputArgv []string, logger vlog.Printer) error
}

// all validations of the arguments should go in here
//
//nolint:dupl
func (c *CmdCreateArchive) validateParse(logger vlog.Printer) error {
logger.Info("Called validateParse()")

Expand All @@ -132,18 +130,18 @@ func (c *CmdCreateArchive) validateParse(logger vlog.Printer) error {
return err
}

err = c.setConfigParam(&c.createArchiveOptions.DatabaseOptions)
if err != nil {
return err
}

if !c.usePassword() {
err = c.getCertFilesFromCertPaths(&c.createArchiveOptions.DatabaseOptions)
if err != nil {
return err
}
}

err = c.setConfigParam(&c.createArchiveOptions.DatabaseOptions)
if err != nil {
return err
}

err = c.setDBPassword(&c.createArchiveOptions.DatabaseOptions)
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions commands/cmd_save_restore_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ func (c *CmdSaveRestorePoint) Parse(inputArgv []string, logger vlog.Printer) err
}

// all validations of the arguments should go in here
//
//nolint:dupl
func (c *CmdSaveRestorePoint) validateParse(logger vlog.Printer) error {
logger.Info("Called validateParse()")

Expand Down
8 changes: 4 additions & 4 deletions vclusterops/create_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type VCreateArchiveOptions struct {
// Required arguments
ArchiveName string
// Optional arguments
NumOfArchives int
Sandbox string
NumRestorePoint int
Sandbox string
}

func VCreateArchiveFactory() VCreateArchiveOptions {
Expand Down Expand Up @@ -67,7 +67,7 @@ func (options *VCreateArchiveOptions) validateRequiredOptions(logger vlog.Printe
}

func (options *VCreateArchiveOptions) validateExtraOptions() error {
if options.NumOfArchives < 0 {
if options.NumRestorePoint < 0 {
return fmt.Errorf("number of restore points must greater than 0")
}
if options.Sandbox != "" {
Expand Down Expand Up @@ -184,7 +184,7 @@ func (vcc *VClusterCommands) produceCreateArchiveInstructions(options *VCreateAr
bootstrapHost := []string{getInitiator(hosts)}

httpsCreateArchiveOp, err := makeHTTPSCreateArchiveOp(bootstrapHost, options.usePassword,
options.UserName, options.Password, options.ArchiveName, options.NumOfArchives)
options.UserName, options.Password, options.ArchiveName, options.NumRestorePoint)
if err != nil {
return instructions, err
}
Expand Down

0 comments on commit ad8f71c

Please sign in to comment.