You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/09/25 18:06:28 UTC

[incubator-openwhisk-wskdeploy] branch master updated: Add strict flag for user defined runtime. (#541)

This is an automated email from the ASF dual-hosted git repository.

mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-wskdeploy.git


The following commit(s) were added to refs/heads/master by this push:
     new 02c5ddd  Add strict flag for user defined runtime. (#541)
02c5ddd is described below

commit 02c5dddc1f70c4ce3c4ff7d026981cea3226eeba
Author: David Liu <no...@126.com>
AuthorDate: Tue Sep 26 02:06:27 2017 +0800

    Add strict flag for user defined runtime. (#541)
---
 cmd/root.go                |  1 +
 parsers/manifest_parser.go | 16 ++++++++--------
 utils/flags.go             |  1 +
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/cmd/root.go b/cmd/root.go
index 1aa0f83..1c44e76 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -109,6 +109,7 @@ func init() {
 	RootCmd.Flags().StringVarP(&utils.Flags.ProjectPath, "pathpath", "p", ".", "path to serverless project")
 	RootCmd.Flags().StringVarP(&utils.Flags.ManifestPath, "manifest", "m", "", "path to manifest file")
 	RootCmd.Flags().StringVarP(&utils.Flags.DeploymentPath, "deployment", "d", "", "path to deployment file")
+	RootCmd.PersistentFlags().BoolVarP(&utils.Flags.Strict,"strict", "s", false, "allow user defined runtime version")
 	RootCmd.PersistentFlags().BoolVarP(&utils.Flags.UseInteractive, "allow-interactive", "i", false, "allow interactive prompts")
 	RootCmd.PersistentFlags().BoolVarP(&utils.Flags.UseDefaults, "allow-defaults", "a", false, "allow defaults")
 	RootCmd.PersistentFlags().BoolVarP(&utils.Flags.Verbose, "verbose", "v", false, "verbose output")
diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index ef0b014..ef79293 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -414,14 +414,14 @@ func (dm *YAMLParser) ComposeActions(filePath string, actions map[string]Action,
 		if action.Runtime != "" {
 			if utils.CheckExistRuntime(action.Runtime, utils.Rts) {
 				wskaction.Exec.Kind = action.Runtime
-			} else {
-				errStr := wski18n.T("the runtime is not supported by Openwhisk platform.\n")
-				whisk.Debug(whisk.DbgWarn, errStr)
-			}
-		} else {
-			errStr := wski18n.T("wskdeploy has chosen a particular runtime for the action.\n")
-			whisk.Debug(whisk.DbgWarn, errStr)
-		}
+
+			} else if utils.Flags.Strict {
+                wskaction.Exec.Kind = action.Runtime
+            } else {
+                errStr := wski18n.T("wskdeploy has chosen a particular runtime for the action.\n")
+			    whisk.Debug(whisk.DbgWarn, errStr)
+            }
+        }
 
 		// we can specify the name of the action entry point using main
 		if action.Main != "" {
diff --git a/utils/flags.go b/utils/flags.go
index 451ddab..59ffce0 100644
--- a/utils/flags.go
+++ b/utils/flags.go
@@ -32,6 +32,7 @@ var Flags struct {
 	ManifestPath    string
 	UseDefaults     bool
 	UseInteractive  bool
+	Strict          bool   // strict flag to support user defined runtime version.
 
 	//action flag definition
 	//from go cli

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].