openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrutkow...@apache.org
Subject [incubator-openwhisk-wskdeploy] branch master updated: Enable field 'function' of Action entity, mark 'location' as deprecated field, (#367)
Date Tue, 22 Aug 2017 20:56:48 GMT
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 32c440c  Enable field 'function' of Action entity, mark 'location' as deprecated
field, (#367)
32c440c is described below

commit 32c440c64842f80aad7a37a2bba18b93240f7c19
Author: Ying Chun Guo <guoyingc@cn.ibm.com>
AuthorDate: Wed Aug 23 04:56:46 2017 +0800

    Enable field 'function' of Action entity, mark 'location' as deprecated field, (#367)
    
    According to Action definition in the specification.
    
    Address issue #311
---
 parsers/manifest_parser.go                         | 23 +++++++++-------------
 parsers/yamlparser.go                              |  3 ++-
 tests/dat/manifest_validate_multiline_params.yaml  |  2 +-
 tests/dat/manifest_validate_singleline_params.yaml |  2 +-
 tests/src/integration/flagstests/manifest.yaml     |  2 +-
 tests/src/integration/flagstests/manifest.yml      |  2 +-
 tests/src/integration/jaraction/manifest.yaml      |  2 +-
 tests/src/integration/triggerrule/manifest.yml     |  2 +-
 tests/src/integration/webaction/manifest.yml       |  2 +-
 tests/src/integration/zipaction/manifest.yml       |  2 +-
 tests/usecases/alarmtrigger/manifest.yaml          |  2 +-
 .../usecases/api-gateway/simple_api_manifest.yaml  |  4 ++--
 tests/usecases/data-processing-app/manifest.yaml   |  6 +++---
 tests/usecases/helloworld/manifest.yaml            |  4 ++--
 tests/usecases/openstack/manifest.yaml             | 10 +++++-----
 tests/usecases/triggerrule/manifest.yml            |  2 +-
 tests/usecases/webhook/manifest.yml                |  2 +-
 tests/usecases/whiskbot/manifest.yaml              | 16 +++++++--------
 18 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 8d7113c..d27051e 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -239,6 +239,11 @@ func (dm *YAMLParser) ComposeActions(mani *ManifestYAML, manipath string)
(ar []
 
 	for key, action := range mani.Package.Actions {
 		splitmanipath := strings.Split(manipath, string(os.PathSeparator))
+		//set action.Function to action.Location
+		//because Location is deprecated in Action entity
+		if action.Function == "" && action.Location != "" {
+			action.Function = action.Location
+		}
 
 		wskaction := new(whisk.Action)
 		//bind action, and exposed URL
@@ -247,8 +252,8 @@ func (dm *YAMLParser) ComposeActions(mani *ManifestYAML, manipath string)
(ar []
 		aubinding.ExposedUrl = action.ExposedUrl
 
 		wskaction.Exec = new(whisk.Exec)
-		if action.Location != "" {
-			filePath := strings.TrimRight(manipath, splitmanipath[len(splitmanipath)-1]) + action.Location
+		if action.Function != "" {
+			filePath := strings.TrimRight(manipath, splitmanipath[len(splitmanipath)-1]) + action.Function
 
 			if utils.IsDirectory(filePath) {
 				zipName := filePath + ".zip"
@@ -272,7 +277,7 @@ func (dm *YAMLParser) ComposeActions(mani *ManifestYAML, manipath string)
(ar []
 
 				wskaction.Exec.Kind = kind
 
-				action.Location = filePath
+				action.Function = filePath
 				dat, err := utils.Read(filePath)
 				utils.Check(err)
 				code := string(dat)
@@ -333,7 +338,7 @@ func (dm *YAMLParser) ComposeActions(mani *ManifestYAML, manipath string)
(ar []
 		pub := false
 		wskaction.Publish = &pub
 
-		record := utils.ActionRecord{wskaction, mani.Package.Packagename, action.Location}
+		record := utils.ActionRecord{wskaction, mani.Package.Packagename, action.Function}
 		s1 = append(s1, record)
 
 		//only append when the fields are exists
@@ -416,16 +421,6 @@ func (dm *YAMLParser) ComposeRules(manifest *ManifestYAML) ([]*whisk.Rule,
error
 	return r1, nil
 }
 
-func (action *Action) ComposeWskAction(manipath string) (*whisk.Action, error) {
-	wskaction, err := utils.CreateActionFromFile(manipath, action.Location)
-	utils.Check(err)
-	wskaction.Name = action.Name
-	wskaction.Version = action.Version
-	wskaction.Namespace = action.Namespace
-	return wskaction, err
-}
-
-
 // TODO(): Support other valid Package Manifest types
 // TODO(): i.e., json (valid), timestamp, version, string256, string64, string16
 // TODO(): Support JSON schema validation for type: json
diff --git a/parsers/yamlparser.go b/parsers/yamlparser.go
index 6be7b44..23c4f6c 100644
--- a/parsers/yamlparser.go
+++ b/parsers/yamlparser.go
@@ -51,7 +51,8 @@ type YAMLParser struct {
 type Action struct {
 	//mapping to wsk.Action.Version
 	Version  string `yaml:"version"`  //used in manifest.yaml
-	Location string `yaml:"location"` //used in manifest.yaml
+	Location string `yaml:"location"` //deprecated, used in manifest.yaml
+	Function string `yaml:"function"` //used in manifest.yaml
 	Runtime  string `yaml:"runtime"`  //used in manifest.yaml
 	//mapping to wsk.Action.Namespace
 	Namespace  string                 `yaml:"namespace"`  //used in deployment.yaml
diff --git a/tests/dat/manifest_validate_multiline_params.yaml b/tests/dat/manifest_validate_multiline_params.yaml
index c5cf966..9aa764d 100644
--- a/tests/dat/manifest_validate_multiline_params.yaml
+++ b/tests/dat/manifest_validate_multiline_params.yaml
@@ -2,7 +2,7 @@ package:
     name: validate
     actions:
         validate_multiline_params:
-            location: actions/dump_params.js
+            function: actions/dump_params.js
             runtime: nodejs:6
             inputs:
                 # value only
diff --git a/tests/dat/manifest_validate_singleline_params.yaml b/tests/dat/manifest_validate_singleline_params.yaml
index f18de5f..cc420b0 100644
--- a/tests/dat/manifest_validate_singleline_params.yaml
+++ b/tests/dat/manifest_validate_singleline_params.yaml
@@ -2,7 +2,7 @@ package:
     name: validate
     actions:
         validate_singleline_params:
-            location: actions/dump_params.js
+            function: actions/dump_params.js
             runtime: nodejs:6
             inputs:
                 # simple string
diff --git a/tests/src/integration/flagstests/manifest.yaml b/tests/src/integration/flagstests/manifest.yaml
index 42835a5..0785fd9 100644
--- a/tests/src/integration/flagstests/manifest.yaml
+++ b/tests/src/integration/flagstests/manifest.yaml
@@ -6,7 +6,7 @@ package:
     greeting:
       web-export: true
       version: 1.0
-      location: src/greeting.js
+      function: src/greeting.js
       runtime: nodejs:6
       inputs:
         name: string
diff --git a/tests/src/integration/flagstests/manifest.yml b/tests/src/integration/flagstests/manifest.yml
index 42835a5..0785fd9 100644
--- a/tests/src/integration/flagstests/manifest.yml
+++ b/tests/src/integration/flagstests/manifest.yml
@@ -6,7 +6,7 @@ package:
     greeting:
       web-export: true
       version: 1.0
-      location: src/greeting.js
+      function: src/greeting.js
       runtime: nodejs:6
       inputs:
         name: string
diff --git a/tests/src/integration/jaraction/manifest.yaml b/tests/src/integration/jaraction/manifest.yaml
index 34befa4..dcab28a 100644
--- a/tests/src/integration/jaraction/manifest.yaml
+++ b/tests/src/integration/jaraction/manifest.yaml
@@ -2,6 +2,6 @@ package:
     name: helloworldjar
     actions:
         helloworld:
-            location: src/hello.jar
+            function: src/hello.jar
             runtime: java
             main: Hello
diff --git a/tests/src/integration/triggerrule/manifest.yml b/tests/src/integration/triggerrule/manifest.yml
index a707617..ce324be 100644
--- a/tests/src/integration/triggerrule/manifest.yml
+++ b/tests/src/integration/triggerrule/manifest.yml
@@ -5,7 +5,7 @@ package:
   actions:
     greeting:
       version: 1.0
-      location: src/greeting.js
+      function: src/greeting.js
       runtime: nodejs:6
       inputs:
         name: string
diff --git a/tests/src/integration/webaction/manifest.yml b/tests/src/integration/webaction/manifest.yml
index 42835a5..0785fd9 100644
--- a/tests/src/integration/webaction/manifest.yml
+++ b/tests/src/integration/webaction/manifest.yml
@@ -6,7 +6,7 @@ package:
     greeting:
       web-export: true
       version: 1.0
-      location: src/greeting.js
+      function: src/greeting.js
       runtime: nodejs:6
       inputs:
         name: string
diff --git a/tests/src/integration/zipaction/manifest.yml b/tests/src/integration/zipaction/manifest.yml
index 72009eb..84ec973 100644
--- a/tests/src/integration/zipaction/manifest.yml
+++ b/tests/src/integration/zipaction/manifest.yml
@@ -5,7 +5,7 @@ package:
   actions:
     cat:
       version: 1.0
-      location: actions/cat
+      function: actions/cat
       runtime: nodejs:6
       inputs:
         name: string
diff --git a/tests/usecases/alarmtrigger/manifest.yaml b/tests/usecases/alarmtrigger/manifest.yaml
index 36f0bcb..5c52910 100644
--- a/tests/usecases/alarmtrigger/manifest.yaml
+++ b/tests/usecases/alarmtrigger/manifest.yaml
@@ -2,7 +2,7 @@ package:
     name: helloworld
     actions:
         helloworld:
-            location: actions/hello.js
+            function: actions/hello.js
             runtime: nodejs:6
             inputs:
                 name:
diff --git a/tests/usecases/api-gateway/simple_api_manifest.yaml b/tests/usecases/api-gateway/simple_api_manifest.yaml
index c4ecb10..e8967a2 100644
--- a/tests/usecases/api-gateway/simple_api_manifest.yaml
+++ b/tests/usecases/api-gateway/simple_api_manifest.yaml
@@ -4,8 +4,8 @@ package:
   license: Apache-2.0
   actions:
       fire:
-        location: actions/fire/index.js
+        function: actions/fire/index.js
         inputs:
           triggerName: trgger1
           type: string
-        exposedUrl: post/whiskbot/slack-event/
\ No newline at end of file
+        exposedUrl: post/whiskbot/slack-event/
diff --git a/tests/usecases/data-processing-app/manifest.yaml b/tests/usecases/data-processing-app/manifest.yaml
index f77e735..4ac7282 100644
--- a/tests/usecases/data-processing-app/manifest.yaml
+++ b/tests/usecases/data-processing-app/manifest.yaml
@@ -5,11 +5,11 @@ package:
   actions:
     mhpost-action:
       version: 1.0
-      location: actions/mhpost
+      function: actions/mhpost
       runtime: nodejs:6
     mhget-action:
       version: 1.0
-      location: actions/mhget/mhget.js
+      function: actions/mhget/mhget.js
       runtime: nodejs:6
   triggers:
     kafka-trigger:
@@ -19,4 +19,4 @@ package:
   rules:
     kafka-inbound-rule:
       trigger: kafka-trigger
-      action: kafka-sequence
\ No newline at end of file
+      action: kafka-sequence
diff --git a/tests/usecases/helloworld/manifest.yaml b/tests/usecases/helloworld/manifest.yaml
index a440f5e..ffcd9c1 100644
--- a/tests/usecases/helloworld/manifest.yaml
+++ b/tests/usecases/helloworld/manifest.yaml
@@ -5,14 +5,14 @@ package:
   actions:
     hello:
       version: 2.0
-      location: actions/greeting.js
+      function: actions/greeting.js
       runtime: nodejs:6
       inputs:
         name: Paul
         place: Boston
     helloworld:
       version: 1.0
-      location: actions/greeting2.js
+      function: actions/greeting2.js
       runtime: nodejs:6
       inputs:
         name: Bernie
diff --git a/tests/usecases/openstack/manifest.yaml b/tests/usecases/openstack/manifest.yaml
index bb0c5c4..04a3fa8 100644
--- a/tests/usecases/openstack/manifest.yaml
+++ b/tests/usecases/openstack/manifest.yaml
@@ -4,13 +4,13 @@ package:
   license: Apache-2.0
   actions:
     getApiToken:
-      location: actions/getApiToken.js
+      function: actions/getApiToken.js
     getServers:
-      location: actions/getServers.js
+      function: actions/getServers.js
     createBackup:
-      location: actions/createBackup.js
+      function: actions/createBackup.js
     callSlack:
-      location: actions/callSlack.js
+      function: actions/callSlack.js
   sequences:
       authorizedBackup:
         actions: getApiToken, getServers, createBackup, callSlack
@@ -33,4 +33,4 @@ package:
       action: authorizedBackup
     backupRule_WEB:
       trigger: backupTrigger_WEB
-      action: authorizedBackup
\ No newline at end of file
+      action: authorizedBackup
diff --git a/tests/usecases/triggerrule/manifest.yml b/tests/usecases/triggerrule/manifest.yml
index 949e2e9..6c3ab3d 100644
--- a/tests/usecases/triggerrule/manifest.yml
+++ b/tests/usecases/triggerrule/manifest.yml
@@ -5,7 +5,7 @@ package:
   actions:
     greeting:
       version: 1.0
-      location: src/greeting.js
+      function: src/greeting.js
       runtime: nodejs:6
       inputs:
         name: string
diff --git a/tests/usecases/webhook/manifest.yml b/tests/usecases/webhook/manifest.yml
index a7f3097..3317410 100644
--- a/tests/usecases/webhook/manifest.yml
+++ b/tests/usecases/webhook/manifest.yml
@@ -5,7 +5,7 @@ package:
   actions:
     webhook:
       version: 1.0
-      location: src/webhook.js
+      function: src/webhook.js
       runtime: nodejs:6
       inputs:
         username:
diff --git a/tests/usecases/whiskbot/manifest.yaml b/tests/usecases/whiskbot/manifest.yaml
index 7114edc..530c196 100644
--- a/tests/usecases/whiskbot/manifest.yaml
+++ b/tests/usecases/whiskbot/manifest.yaml
@@ -20,15 +20,15 @@ package:
       type: string
   actions:
       challenge:
-        location: actions/challenge/index.js
+        function: actions/challenge/index.js
       configure-backend:
-        location: actions/configure-backend/index.js
+        function: actions/configure-backend/index.js
       decrypt:
-        location: actions/decrypt/index.js
+        function: actions/decrypt/index.js
       encrypt:
-        location: actions/encrypt/index.js
+        function: actions/encrypt/index.js
       fire:
-        location: actions/fire/index.js
+        function: actions/fire/index.js
         inputs:
           triggerName:
             type: string
@@ -36,11 +36,11 @@ package:
           web-export:
             type: boolean
       getSetupURL:
-        location: actions/getSetupURL/index.js
+        function: actions/getSetupURL/index.js
       getWhiskAuthAndNamspace:
-        location: actions/getWhiskAuthAndNamespace/index.js
+        function: actions/getWhiskAuthAndNamespace/index.js
       newbot-setup:
-        location: actions/newbot-setup/index.js
+        function: actions/newbot-setup/index.js
         inputs:
           configPage:
             type: string

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

Mime
View raw message