()
| 120 | } |
| 121 | |
| 122 | func (cmd RestageCommand) ValidateFlags() error { |
| 123 | switch { |
| 124 | case cmd.Strategy.Name == constant.DeploymentStrategyDefault && cmd.MaxInFlight != nil: |
| 125 | return translatableerror.RequiredFlagsError{Arg1: "--max-in-flight", Arg2: "--strategy"} |
| 126 | case cmd.Strategy.Name != constant.DeploymentStrategyDefault && cmd.MaxInFlight != nil && *cmd.MaxInFlight < 1: |
| 127 | return translatableerror.IncorrectUsageError{Message: "--max-in-flight must be greater than or equal to 1"} |
| 128 | case cmd.Strategy.Name != constant.DeploymentStrategyCanary && cmd.InstanceSteps != "": |
| 129 | return translatableerror.RequiredFlagsError{Arg1: "--instance-steps", Arg2: "--strategy=canary"} |
| 130 | case len(cmd.InstanceSteps) > 0 && !validateInstanceSteps(cmd.InstanceSteps): |
| 131 | return translatableerror.ParseArgumentError{ArgumentName: "--instance-steps", ExpectedType: "list of weights"} |
| 132 | } |
| 133 | |
| 134 | if len(cmd.InstanceSteps) > 0 { |
| 135 | return command.MinimumCCAPIVersionCheck(cmd.Config.APIVersion(), ccversion.MinVersionCanarySteps, "--instance-steps") |
| 136 | } |
| 137 | |
| 138 | return nil |
| 139 | } |
| 140 | |
| 141 | func mapErr(config command.Config, appName string, err error) error { |
| 142 | switch err.(type) { |
no test coverage detected