You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/11/01 20:20:00 UTC

[GitHub] pritidesai commented on a change in pull request #631: Adding Action Annotations

pritidesai commented on a change in pull request #631: Adding Action Annotations
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/pull/631#discussion_r148372717
 
 

 ##########
 File path: deployers/deploymentreader.go
 ##########
 @@ -121,25 +126,32 @@ func (reader *DeploymentReader) bindPackageInputsAndAnnotations() {
 			serviceDeployPack.Package.Parameters = keyValArr
 		}
 
-		keyValArr = make(whisk.KeyValueArr, 0)
-
-		if len(pack.Annotations) > 0 {
+		if len(pack.Annotations) >0 {
+			// iterate over each annotation from deployment file
 			for name, input := range pack.Annotations {
-				var keyVal whisk.KeyValue
-
-				keyVal.Key = name
-				keyVal.Value = utils.GetEnvVar(input)
-
-				keyValArr = append(keyValArr, keyVal)
+				// check if annotation key in deployment file exists in manifest file
+				// setting a bool flag to false assuming key does not exist in manifest
+				keyExistsInManifest := false
+				// iterate over each annotation from manifest file
+				for i, a := range serviceDeployPack.Package.Annotations {
+					if name == a.Key {
+						// annotation key is found in manifest
+						keyExistsInManifest = true
+						// overwrite annotation in manifest file with deployment file
+						serviceDeployPack.Package.Annotations[i].Value = input
+						break
+					}
+				}
+				if !keyExistsInManifest {
+					return utils.NewYAMLFormatError("Annotation key \""+name+"\" does not exist in manifest file but specified in deployment file.")
 
 Review comment:
   Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services