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/08/30 02:20:21 UTC

[incubator-openwhisk-wskdeploy] branch master updated: deploy sequences separately other than combining with actions (#396)

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 6953714  deploy sequences separately other than combining with actions (#396)
6953714 is described below

commit 69537148ed15ee60b4e58d390efc8d4691703873
Author: Ying Chun Guo <gu...@cn.ibm.com>
AuthorDate: Wed Aug 30 10:20:20 2017 +0800

    deploy sequences separately other than combining with actions (#396)
---
 deployers/manifestreader.go | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/deployers/manifestreader.go b/deployers/manifestreader.go
index d137c20..f7c9b77 100644
--- a/deployers/manifestreader.go
+++ b/deployers/manifestreader.go
@@ -220,7 +220,41 @@ func (reader *ManifestReader) checkAction(action utils.ActionRecord) error {
 }
 
 func (reader *ManifestReader) SetSequences(actions []utils.ActionRecord) error {
-	return reader.SetActions(actions)
+	dep := reader.serviceDeployer
+
+	dep.mt.Lock()
+	defer dep.mt.Unlock()
+
+	for _, seqAction := range actions {
+		// check if the sequence action is exist in actions
+		// If the sequence action exists in actions, return error
+		_, exists := reader.serviceDeployer.Deployment.Packages[seqAction.Packagename].Actions[seqAction.Action.Name]
+		if exists == true {
+			return errors.New("manifestReader. Error: Conflict sequence action with an action. "+
+					"Found a sequence action with the same name of an action:"+
+					seqAction.Action.Name)
+		}
+		existAction, exists := reader.serviceDeployer.Deployment.Packages[seqAction.Packagename].Sequences[seqAction.Action.Name]
+
+		if exists == true {
+			existAction.Action.Annotations = seqAction.Action.Annotations
+			existAction.Action.Exec.Kind = "sequence"
+			existAction.Action.Exec.Components = seqAction.Action.Exec.Components
+			existAction.Action.Publish = seqAction.Action.Publish
+			existAction.Action.Namespace = seqAction.Action.Namespace
+			existAction.Action.Limits = seqAction.Action.Limits
+			existAction.Action.Parameters = seqAction.Action.Parameters
+			existAction.Action.Version = seqAction.Action.Version
+		} else {
+			// not a new action so update the action in the package
+			err := reader.checkAction(seqAction)
+			utils.Check(err)
+			reader.serviceDeployer.Deployment.Packages[seqAction.Packagename].Sequences[seqAction.Action.Name] = seqAction
+		}
+	}
+
+	return nil
+
 }
 
 func (reader *ManifestReader) SetTriggers(triggers []*whisk.Trigger) error {

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