Replace flag text with const (#1391)
This commit is contained in:
@@ -30,13 +30,13 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Create),
|
||||
}
|
||||
wrapper.SetFlags(createCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag, flag.NamespaceEnvironmentFlag, flag.SpecSaveFlag,
|
||||
flag.FnEnvNameFlag, flag.FnCodeFlag, flag.PkgSrcArchiveFlag, flag.PkgDeployArchiveFlag, flag.FnKeepURLFlag,
|
||||
flag.FnEntryPointFlag, flag.FnBuildCmdFlag, flag.FnPkgNameFlag, flag.HtUrlFlag, flag.HtMethodFlag,
|
||||
flag.RunTimeMinCPUFlag, flag.RunTimeMaxCPUFlag, flag.RunTimeMinMemoryFlag, flag.RunTimeMaxMemoryFlag,
|
||||
flag.ReplicasMinFlag, flag.ReplicasMaxFlag, flag.FnExecutorTypeFlag, flag.RunTimeTargetCPUFlag,
|
||||
flag.FnCfgMapFlag, flag.FnSecretFlag, flag.FnSpecializationTimeoutFlag, flag.FnExecutionTimeoutFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction, flag.NamespaceEnvironment, flag.SpecSave,
|
||||
flag.FnEnvName, flag.FnCode, flag.PkgSrcArchive, flag.PkgDeployArchive, flag.FnKeepURL,
|
||||
flag.FnEntryPoint, flag.FnBuildCmd, flag.FnPkgName, flag.HtUrl, flag.HtMethod,
|
||||
flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory, flag.RunTimeMaxMemory,
|
||||
flag.ReplicasMin, flag.ReplicasMax, flag.FnExecutorType, flag.RunTimeTargetCPU,
|
||||
flag.FnCfgMap, flag.FnSecret, flag.FnSpecializationTimeout, flag.FnExecutionTimeout},
|
||||
})
|
||||
|
||||
getCmd := &cobra.Command{
|
||||
@@ -46,8 +46,8 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Get),
|
||||
}
|
||||
wrapper.SetFlags(getCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction},
|
||||
})
|
||||
|
||||
getmetaCmd := &cobra.Command{
|
||||
@@ -57,8 +57,8 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(GetMeta),
|
||||
}
|
||||
wrapper.SetFlags(getmetaCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction},
|
||||
})
|
||||
|
||||
updateCmd := &cobra.Command{
|
||||
@@ -68,14 +68,14 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Update),
|
||||
}
|
||||
wrapper.SetFlags(updateCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag, flag.NamespaceEnvironmentFlag, flag.SpecSaveFlag,
|
||||
flag.FnCodeFlag, flag.PkgSrcArchiveFlag, flag.PkgDeployArchiveFlag,
|
||||
flag.FnKeepURLFlag, flag.FnEntryPointFlag, flag.FnBuildCmdFlag, flag.FnPkgNameFlag, flag.HtUrlFlag,
|
||||
flag.HtMethodFlag, flag.RunTimeMinCPUFlag, flag.RunTimeMaxCPUFlag, flag.RunTimeMinMemoryFlag,
|
||||
flag.RunTimeMaxMemoryFlag, flag.ReplicasMinFlag, flag.ReplicasMaxFlag, flag.FnExecutorTypeFlag,
|
||||
flag.RunTimeTargetCPUFlag, flag.FnCfgMapFlag, flag.FnSecretFlag, flag.FnSpecializationTimeoutFlag,
|
||||
flag.FnExecutionTimeoutFlag, flag.PkgForceFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction, flag.NamespaceEnvironment, flag.SpecSave,
|
||||
flag.FnCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
|
||||
flag.FnKeepURL, flag.FnEntryPoint, flag.FnBuildCmd, flag.FnPkgName, flag.HtUrl,
|
||||
flag.HtMethod, flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory,
|
||||
flag.RunTimeMaxMemory, flag.ReplicasMin, flag.ReplicasMax, flag.FnExecutorType,
|
||||
flag.RunTimeTargetCPU, flag.FnCfgMap, flag.FnSecret, flag.FnSpecializationTimeout,
|
||||
flag.FnExecutionTimeout, flag.PkgForce},
|
||||
})
|
||||
|
||||
deleteCmd := &cobra.Command{
|
||||
@@ -85,8 +85,8 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Delete),
|
||||
}
|
||||
wrapper.SetFlags(deleteCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction},
|
||||
})
|
||||
|
||||
listCmd := &cobra.Command{
|
||||
@@ -96,7 +96,7 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(List),
|
||||
}
|
||||
wrapper.SetFlags(listCmd, flag.FlagSet{
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction},
|
||||
})
|
||||
|
||||
logsCmd := &cobra.Command{
|
||||
@@ -106,9 +106,9 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Log),
|
||||
}
|
||||
wrapper.SetFlags(logsCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag, flag.FnLogPodFlag, flag.FnLogFollowFlag,
|
||||
flag.FnLogDetailFlag, flag.FnLogDBTypeFlag, flag.FnLogReverseQueryFlag, flag.FnLogCountFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction, flag.FnLogPod, flag.FnLogFollow,
|
||||
flag.FnLogDetail, flag.FnLogDBType, flag.FnLogReverseQuery, flag.FnLogCount},
|
||||
})
|
||||
|
||||
testCmd := &cobra.Command{
|
||||
@@ -118,9 +118,9 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Test),
|
||||
}
|
||||
wrapper.SetFlags(testCmd, flag.FlagSet{
|
||||
Required: []flag.Flag{flag.FnNameFlag},
|
||||
Optional: []flag.Flag{flag.NamespaceFunctionFlag, flag.HtMethodFlag, flag.FnTestBodyFlag,
|
||||
flag.FnTestHeaderFlag, flag.FnTestQueryFlag, flag.FnTestTimeoutFlag},
|
||||
Required: []flag.Flag{flag.FnName},
|
||||
Optional: []flag.Flag{flag.NamespaceFunction, flag.HtMethod, flag.FnTestBody,
|
||||
flag.FnTestHeader, flag.FnTestQuery, flag.FnTestTimeout},
|
||||
})
|
||||
|
||||
command := &cobra.Command{
|
||||
|
||||
@@ -83,12 +83,10 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
specDir := util.GetSpecDir(input)
|
||||
|
||||
// check for unique function names within a namespace
|
||||
metadata, err := util.GetMetadata(flagkey.FnName, flagkey.NamespaceFunction, input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fn, err := opts.client.FunctionGet(metadata)
|
||||
fn, err := opts.client.FunctionGet(&metav1.ObjectMeta{
|
||||
Name: input.String(flagkey.FnName),
|
||||
Namespace: input.String(flagkey.NamespaceFunction),
|
||||
})
|
||||
if err != nil && !ferror.IsNotFound(err) {
|
||||
return err
|
||||
} else if fn != nil {
|
||||
@@ -174,7 +172,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
keepURL := input.Bool(flagkey.PkgKeepURL)
|
||||
|
||||
// create new package in the same namespace as the function.
|
||||
pkgMetadata, err = _package.CreatePackage(input, opts.client, fnNamespace, envName, envNamespace,
|
||||
pkgMetadata, err = _package.CreatePackage(input, opts.client, fnName, fnNamespace, envName, envNamespace,
|
||||
srcArchiveFiles, deployArchiveFiles, buildcmd, specDir, opts.specFile, noZip, keepURL)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating package")
|
||||
@@ -263,9 +261,9 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
// run write the resource to a spec file or create a fission CRD with remote fission server.
|
||||
// It also prints warning/error if necessary.
|
||||
func (opts *CreateSubCommand) run(flags cli.Input) error {
|
||||
func (opts *CreateSubCommand) run(input cli.Input) error {
|
||||
// if we're writing a spec, don't create the function
|
||||
if flags.Bool(flagkey.SpecSave) {
|
||||
if input.Bool(flagkey.SpecSave) {
|
||||
err := spec.SpecSave(*opts.function, opts.specFile)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating function spec")
|
||||
@@ -281,7 +279,7 @@ func (opts *CreateSubCommand) run(flags cli.Input) error {
|
||||
fmt.Printf("function '%v' created\n", opts.function.Metadata.Name)
|
||||
|
||||
// Allow the user to specify an HTTP trigger while creating a function.
|
||||
triggerUrl := flags.String(flagkey.HtUrl)
|
||||
triggerUrl := input.String(flagkey.HtUrl)
|
||||
if len(triggerUrl) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -289,7 +287,7 @@ func (opts *CreateSubCommand) run(flags cli.Input) error {
|
||||
triggerUrl = fmt.Sprintf("/%s", triggerUrl)
|
||||
}
|
||||
|
||||
method, err := httptrigger.GetMethod(flags.String(flagkey.HtMethod))
|
||||
method, err := httptrigger.GetMethod(input.String(flagkey.HtMethod))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error getting HTTP trigger method")
|
||||
}
|
||||
@@ -318,11 +316,11 @@ func (opts *CreateSubCommand) run(flags cli.Input) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getInvokeStrategy(flags cli.Input, existingInvokeStrategy *fv1.InvokeStrategy) (strategy *fv1.InvokeStrategy, err error) {
|
||||
func getInvokeStrategy(input cli.Input, existingInvokeStrategy *fv1.InvokeStrategy) (strategy *fv1.InvokeStrategy, err error) {
|
||||
|
||||
var fnExecutor, newFnExecutor fv1.ExecutorType
|
||||
|
||||
switch flags.String(flagkey.FnExecutorType) {
|
||||
switch input.String(flagkey.FnExecutorType) {
|
||||
case "":
|
||||
fallthrough
|
||||
case types.ExecutorTypePoolmgr:
|
||||
@@ -337,23 +335,23 @@ func getInvokeStrategy(flags cli.Input, existingInvokeStrategy *fv1.InvokeStrate
|
||||
fnExecutor = existingInvokeStrategy.ExecutionStrategy.ExecutorType
|
||||
|
||||
// override the executor type if user specified a new executor type
|
||||
if flags.IsSet(flagkey.FnExecutorType) {
|
||||
if input.IsSet(flagkey.FnExecutorType) {
|
||||
fnExecutor = newFnExecutor
|
||||
}
|
||||
} else {
|
||||
fnExecutor = newFnExecutor
|
||||
}
|
||||
|
||||
if flags.IsSet(flagkey.FnSpecializationTimeout) && fnExecutor != types.ExecutorTypeNewdeploy {
|
||||
if input.IsSet(flagkey.FnSpecializationTimeout) && fnExecutor != types.ExecutorTypeNewdeploy {
|
||||
return nil, errors.Errorf("%v flag is only applicable for newdeploy type of executor", flagkey.FnSpecializationTimeout)
|
||||
}
|
||||
|
||||
if fnExecutor == types.ExecutorTypePoolmgr {
|
||||
if flags.IsSet(flagkey.RuntimeTargetcpu) || flags.IsSet(flagkey.ReplicasMinscale) || flags.IsSet(flagkey.ReplicasMaxscale) {
|
||||
if input.IsSet(flagkey.RuntimeTargetcpu) || input.IsSet(flagkey.ReplicasMinscale) || input.IsSet(flagkey.ReplicasMaxscale) {
|
||||
return nil, errors.New("to set target CPU or min/max scale for function, please specify \"--executortype newdeploy\"")
|
||||
}
|
||||
|
||||
if flags.IsSet(flagkey.RuntimeMincpu) || flags.IsSet(flagkey.RuntimeMaxcpu) || flags.IsSet(flagkey.RuntimeMinmemory) || flags.IsSet(flagkey.RuntimeMaxmemory) {
|
||||
if input.IsSet(flagkey.RuntimeMincpu) || input.IsSet(flagkey.RuntimeMaxcpu) || input.IsSet(flagkey.RuntimeMinmemory) || input.IsSet(flagkey.RuntimeMaxmemory) {
|
||||
console.Warn("To limit CPU/Memory for function with executor type \"poolmgr\", please specify resources limits when creating environment")
|
||||
}
|
||||
strategy = &fv1.InvokeStrategy{
|
||||
@@ -376,26 +374,26 @@ func getInvokeStrategy(flags cli.Input, existingInvokeStrategy *fv1.InvokeStrate
|
||||
specializationTimeout = existingInvokeStrategy.ExecutionStrategy.SpecializationTimeout
|
||||
}
|
||||
|
||||
if flags.IsSet(flagkey.RuntimeTargetcpu) {
|
||||
targetCPU, err = getTargetCPU(flags)
|
||||
if input.IsSet(flagkey.RuntimeTargetcpu) {
|
||||
targetCPU, err = getTargetCPU(input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if flags.IsSet(flagkey.ReplicasMinscale) {
|
||||
minScale = flags.Int(flagkey.ReplicasMinscale)
|
||||
if input.IsSet(flagkey.ReplicasMinscale) {
|
||||
minScale = input.Int(flagkey.ReplicasMinscale)
|
||||
}
|
||||
|
||||
if flags.IsSet(flagkey.ReplicasMaxscale) {
|
||||
maxScale = flags.Int(flagkey.ReplicasMaxscale)
|
||||
if input.IsSet(flagkey.ReplicasMaxscale) {
|
||||
maxScale = input.Int(flagkey.ReplicasMaxscale)
|
||||
if maxScale <= 0 {
|
||||
return nil, errors.Errorf("%v must be greater than 0", flagkey.ReplicasMaxscale)
|
||||
}
|
||||
}
|
||||
|
||||
if flags.IsSet(flagkey.FnSpecializationTimeout) {
|
||||
specializationTimeout = flags.Int(flagkey.FnSpecializationTimeout)
|
||||
if input.IsSet(flagkey.FnSpecializationTimeout) {
|
||||
specializationTimeout = input.Int(flagkey.FnSpecializationTimeout)
|
||||
if specializationTimeout < fv1.DefaultSpecializationTimeOut {
|
||||
return nil, errors.Errorf("%v must be greater than or equal to 120 seconds", flagkey.FnSpecializationTimeout)
|
||||
}
|
||||
@@ -422,8 +420,8 @@ func getInvokeStrategy(flags cli.Input, existingInvokeStrategy *fv1.InvokeStrate
|
||||
return strategy, nil
|
||||
}
|
||||
|
||||
func getTargetCPU(flags cli.Input) (int, error) {
|
||||
targetCPU := flags.Int(flagkey.RuntimeTargetcpu)
|
||||
func getTargetCPU(input cli.Input) (int, error) {
|
||||
targetCPU := input.Int(flagkey.RuntimeTargetcpu)
|
||||
if targetCPU <= 0 || targetCPU > 100 {
|
||||
return 0, errors.Errorf("%v must be a value between 1 - 100", flagkey.RuntimeTargetcpu)
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ package function
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
fv1 "github.com/fission/fission/pkg/apis/fission.io/v1"
|
||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/dummy"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
)
|
||||
|
||||
func TestGetInvokeStrategy(t *testing.T) {
|
||||
|
||||
@@ -160,9 +160,6 @@ func doHTTPRequest(ctx context.Context, method, url, body string, headers []stri
|
||||
|
||||
func printPodLogs(input cli.Input) error {
|
||||
fnName := input.String(flagkey.FnName)
|
||||
if len(fnName) == 0 {
|
||||
return errors.New("need --name argument.")
|
||||
}
|
||||
|
||||
u, err := util.GetApplicationUrl("application=fission-api")
|
||||
if err != nil {
|
||||
|
||||
@@ -18,7 +18,6 @@ package function
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
@@ -29,6 +28,7 @@ import (
|
||||
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
|
||||
_package "github.com/fission/fission/pkg/fission-cli/cmd/package"
|
||||
"github.com/fission/fission/pkg/fission-cli/console"
|
||||
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
|
||||
"github.com/fission/fission/pkg/fission-cli/util"
|
||||
"github.com/fission/fission/pkg/types"
|
||||
)
|
||||
@@ -61,18 +61,16 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
fnName := input.String(flagkey.FnName)
|
||||
fnNamespace := input.String(flagkey.NamespaceFunction)
|
||||
|
||||
m, err := util.GetMetadata("name", "fnNamespace", input)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
function, err := opts.client.FunctionGet(m)
|
||||
function, err := opts.client.FunctionGet(&metav1.ObjectMeta{
|
||||
Name: input.String(flagkey.FnName),
|
||||
Namespace: input.String(flagkey.NamespaceFunction),
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("read function '%v'", fnName))
|
||||
}
|
||||
|
||||
envName := input.String("env")
|
||||
envNamespace := input.String("envNamespace")
|
||||
envName := input.String(flagkey.FnEnvironmentName)
|
||||
envNamespace := input.String(flagkey.NamespaceEnvironment)
|
||||
// if the new env specified is the same as the old one, no need to update package
|
||||
// same is true for all update parameters, but, for now, we dont check all of them - because, its ok to
|
||||
// re-write the object with same old values, we just end up getting a new resource version for the object.
|
||||
@@ -86,27 +84,27 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
|
||||
var deployArchiveFiles []string
|
||||
codeFlag := false
|
||||
code := input.String("code")
|
||||
code := input.String(flagkey.FnCode)
|
||||
if len(code) == 0 {
|
||||
deployArchiveFiles = input.StringSlice("deploy")
|
||||
deployArchiveFiles = input.StringSlice(flagkey.PkgDeployArchive)
|
||||
} else {
|
||||
deployArchiveFiles = append(deployArchiveFiles, input.String("code"))
|
||||
deployArchiveFiles = append(deployArchiveFiles, input.String(flagkey.FnCode))
|
||||
codeFlag = true
|
||||
}
|
||||
|
||||
srcArchiveFiles := input.StringSlice("src")
|
||||
pkgName := input.String("pkg")
|
||||
entrypoint := input.String("entrypoint")
|
||||
buildcmd := input.String("buildcmd")
|
||||
force := input.Bool("force")
|
||||
srcArchiveFiles := input.StringSlice(flagkey.PkgSrcArchive)
|
||||
pkgName := input.String(flagkey.FnPackageName)
|
||||
entrypoint := input.String(flagkey.FnEntrypoint)
|
||||
buildcmd := input.String(flagkey.PkgBuildCmd)
|
||||
force := input.Bool(flagkey.PkgForce)
|
||||
|
||||
secretNames := input.StringSlice("secret")
|
||||
cfgMapNames := input.StringSlice("configmap")
|
||||
secretNames := input.StringSlice(flagkey.FnSecret)
|
||||
cfgMapNames := input.StringSlice(flagkey.FnCfgMap)
|
||||
|
||||
specializationTimeout := input.Int("specializationtimeout")
|
||||
specializationTimeout := input.Int(flagkey.FnSpecializationTimeout)
|
||||
|
||||
if len(srcArchiveFiles) > 0 && len(deployArchiveFiles) > 0 {
|
||||
return errors.New("Need either of --src or --deploy and not both arguments.")
|
||||
return errors.Errorf("need either of --%v or --%v and not both arguments", flagkey.PkgSrcArchive, flagkey.PkgDeployArchive)
|
||||
}
|
||||
|
||||
var secrets []fv1.SecretReference
|
||||
@@ -171,10 +169,10 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
function.Spec.Package.FunctionName = entrypoint
|
||||
}
|
||||
|
||||
if input.IsSet("fntimeout") {
|
||||
fnTimeout := input.Int("fntimeout")
|
||||
if input.IsSet(flagkey.FnExecutionTimeout) {
|
||||
fnTimeout := input.Int(flagkey.FnExecutionTimeout)
|
||||
if fnTimeout <= 0 {
|
||||
return errors.New("fntimeout must be greater than 0")
|
||||
return errors.Errorf("--%v must be greater than 0", flagkey.FnExecutionTimeout)
|
||||
}
|
||||
function.Spec.FunctionTimeout = fnTimeout
|
||||
}
|
||||
@@ -189,13 +187,13 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
}
|
||||
function.Spec.InvokeStrategy = *strategy
|
||||
|
||||
if input.IsSet("specializationtimeout") {
|
||||
if input.IsSet(flagkey.FnSpecializationTimeout) {
|
||||
if strategy.ExecutionStrategy.ExecutorType != types.ExecutorTypeNewdeploy {
|
||||
return errors.New("specializationtimeout flag is only applicable for newdeploy type of executor")
|
||||
return errors.Errorf("--%v flag is only applicable for newdeploy type of executor", flagkey.FnSpecializationTimeout)
|
||||
}
|
||||
|
||||
if specializationTimeout < fv1.DefaultSpecializationTimeOut {
|
||||
return errors.New("specializationtimeout must be greater than or equal to 120 seconds")
|
||||
return errors.Errorf("--%v must be greater than or equal to 120 seconds", flagkey.FnSpecializationTimeout)
|
||||
} else {
|
||||
function.Spec.InvokeStrategy.ExecutionStrategy.SpecializationTimeout = specializationTimeout
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user