diff --git a/commands/cmd_create_archive.go b/commands/cmd_create_archive.go index 2164911..6a08f29 100644 --- a/commands/cmd_create_archive.go +++ b/commands/cmd_create_archive.go @@ -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, @@ -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()") @@ -132,6 +130,11 @@ 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 { @@ -139,11 +142,6 @@ func (c *CmdCreateArchive) validateParse(logger vlog.Printer) error { } } - err = c.setConfigParam(&c.createArchiveOptions.DatabaseOptions) - if err != nil { - return err - } - err = c.setDBPassword(&c.createArchiveOptions.DatabaseOptions) if err != nil { return err diff --git a/commands/cmd_save_restore_point.go b/commands/cmd_save_restore_point.go index 6dc3f62..c3c6fc7 100644 --- a/commands/cmd_save_restore_point.go +++ b/commands/cmd_save_restore_point.go @@ -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()") diff --git a/vclusterops/create_archive.go b/vclusterops/create_archive.go index 037328b..cb2a640 100644 --- a/vclusterops/create_archive.go +++ b/vclusterops/create_archive.go @@ -30,8 +30,8 @@ type VCreateArchiveOptions struct { // Required arguments ArchiveName string // Optional arguments - NumOfArchives int - Sandbox string + NumRestorePoint int + Sandbox string } func VCreateArchiveFactory() VCreateArchiveOptions { @@ -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 != "" { @@ -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 }