You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ho...@apache.org on 2018/02/09 21:43:02 UTC

[incubator-openwhisk-wskdeploy] branch master updated: making sure apigw token check is done when apis are defined (#727)

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

houshengbo 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 e1df931  making sure apigw token check is done when apis are defined (#727)
e1df931 is described below

commit e1df9319180e0111a224f613c4806a9d0ace720d
Author: Priti Desai <pd...@us.ibm.com>
AuthorDate: Fri Feb 9 13:42:59 2018 -0800

    making sure apigw token check is done when apis are defined (#727)
---
 parsers/manifest_parser.go | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 87d76b3..b8405b1 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -871,12 +871,6 @@ func (dm *YAMLParser) ComposeApiRecordsFromAllPackages(client *whisk.Config, man
 	var requests []*whisk.ApiCreateRequest = make([]*whisk.ApiCreateRequest, 0)
 	manifestPackages := make(map[string]Package)
 
-	// verify APIGW_ACCESS_TOKEN is set before composing APIs
-	// until this point, we dont know whether APIs are specified in manifest or not
-	if len(client.ApigwAccessToken) == 0 {
-		return nil, wskderrors.NewWhiskClientInvalidConfigError(wski18n.ID_MSG_CONFIG_MISSING_APIGW_ACCESS_TOKEN)
-	}
-
 	if manifest.Package.Packagename != "" {
 		return dm.ComposeApiRecords(client, manifest.Package.Packagename, manifest.Package, manifest.Filepath)
 	} else {
@@ -926,6 +920,14 @@ func (dm *YAMLParser) ComposeApiRecordsFromAllPackages(client *whisk.Config, man
 func (dm *YAMLParser) ComposeApiRecords(client *whisk.Config, packageName string, pkg Package, manifestPath string) ([]*whisk.ApiCreateRequest, error) {
 	var requests []*whisk.ApiCreateRequest = make([]*whisk.ApiCreateRequest, 0)
 
+	if pkg.Apis != nil {
+		// verify APIGW_ACCESS_TOKEN is set before composing APIs
+		// until this point, we dont know whether APIs are specified in manifest or not
+		if len(client.ApigwAccessToken) == 0 {
+			return nil, wskderrors.NewWhiskClientInvalidConfigError(wski18n.ID_MSG_CONFIG_MISSING_APIGW_ACCESS_TOKEN)
+		}
+	}
+
 	for apiName, apiDoc := range pkg.Apis {
 		for gatewayBasePath, gatewayBasePathMap := range apiDoc {
 			// append "/" to the gateway base path if its missing

-- 
To stop receiving notification emails like this one, please contact
houshengbo@apache.org.