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/12 02:02:56 UTC
[incubator-openwhisk-wskdeploy] branch master updated: Use feed in
trigger entity instead of source (#465)
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 efa2550 Use feed in trigger entity instead of source (#465)
efa2550 is described below
commit efa25508dc20a43efa149255decb8e56bb7ad3e5
Author: Ying Chun Guo <gu...@cn.ibm.com>
AuthorDate: Tue Sep 12 10:02:55 2017 +0800
Use feed in trigger entity instead of source (#465)
---
parsers/manifest_parser.go | 14 ++++++++++++--
parsers/manifest_parser_test.go | 3 +--
tests/usecases/alarmtrigger/manifest.yaml | 2 +-
tests/usecases/github/manifest.yaml | 2 +-
wski18n/resources/en_US.all.json | 4 ++++
5 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 44d9669..a631a70 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -31,6 +31,7 @@ import (
"fmt"
"github.com/apache/incubator-openwhisk-client-go/whisk"
"github.com/apache/incubator-openwhisk-wskdeploy/utils"
+ "github.com/apache/incubator-openwhisk-wskdeploy/wski18n"
"gopkg.in/yaml.v2"
)
@@ -384,12 +385,21 @@ func (dm *YAMLParser) ComposeTriggers(manifest *ManifestYAML) ([]*whisk.Trigger,
pub := false
wsktrigger.Publish = &pub
- keyValArr := make(whisk.KeyValueArr, 0)
+ //print warning information when .Source is not empty
if trigger.Source != "" {
+ warningString := wski18n.T("WARNING: The 'source' YAML key in trigger entity is deprecated. Please use 'feed' instead as described in specifications.\n")
+ whisk.Debug(whisk.DbgWarn, warningString)
+ }
+ if trigger.Feed == "" {
+ trigger.Feed = trigger.Source
+ }
+
+ keyValArr := make(whisk.KeyValueArr, 0)
+ if trigger.Feed != "" {
var keyVal whisk.KeyValue
keyVal.Key = "feed"
- keyVal.Value = trigger.Source
+ keyVal.Value = trigger.Feed
keyValArr = append(keyValArr, keyVal)
diff --git a/parsers/manifest_parser_test.go b/parsers/manifest_parser_test.go
index f6cf7f9..d1c91b4 100644
--- a/parsers/manifest_parser_test.go
+++ b/parsers/manifest_parser_test.go
@@ -956,7 +956,6 @@ func TestComposeSequences(t *testing.T) {
}
func TestComposeTriggers(t *testing.T) {
-//TODO 'source' should changed to 'feed' according to the spec after #450 is fixed.
data :=`package:
name: helloworld
triggers:
@@ -965,7 +964,7 @@ func TestComposeTriggers(t *testing.T) {
name: string
place: string
trigger2:
- source: myfeed
+ feed: myfeed
inputs:
name: myname
place: myplace`
diff --git a/tests/usecases/alarmtrigger/manifest.yaml b/tests/usecases/alarmtrigger/manifest.yaml
index 5c52910..6149417 100644
--- a/tests/usecases/alarmtrigger/manifest.yaml
+++ b/tests/usecases/alarmtrigger/manifest.yaml
@@ -17,7 +17,7 @@ package:
description: a simple greeting message, Hello World!
triggers:
Every12Hours:
- source: /whisk.system/alarms/alarm
+ feed: /whisk.system/alarms/alarm
rules:
helloworldEvery12Hours:
action: helloworld
diff --git a/tests/usecases/github/manifest.yaml b/tests/usecases/github/manifest.yaml
index c166cdb..fba48ba 100644
--- a/tests/usecases/github/manifest.yaml
+++ b/tests/usecases/github/manifest.yaml
@@ -6,7 +6,7 @@ package:
runtime: nodejs:6
triggers:
GitHubWebhookTrigger:
- source: /whisk.system/github/webhook
+ feed: /whisk.system/github/webhook
rules:
rule-for-github-commits:
action: print-github-commits
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index cdf8f73..78b97a9 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -205,6 +205,10 @@
{
"id": "Got error deleting package with error message: {{.err}} and error code: {{.code}}.\n",
"translation": "Got error deleting package with error message: {{.err}} and error code: {{.code}}.\n"
+ },
+ {
+ "id": "WARNING: The 'source' YAML key in trigger entity is deprecated. Please use 'feed' instead as described in specifications.\n",
+ "translation": "WARNING: The 'source' YAML key in trigger entity is deprecated. Please use 'feed' instead as described in specifications.\n"
}
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].