openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrutkow...@apache.org
Subject [openwhisk-wskdeploy] branch master updated: Auto supply a dummy API GW token (#1068)
Date Wed, 11 Sep 2019 13:15:47 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/openwhisk-wskdeploy.git


The following commit(s) were added to refs/heads/master by this push:
     new 01cfe67  Auto supply a dummy API GW token (#1068)
01cfe67 is described below

commit 01cfe67c4393e93acc44935c5fc14196283ed137
Author: jiangpch <jiangpengcheng@navercorp.com>
AuthorDate: Wed Sep 11 21:15:40 2019 +0800

    Auto supply a dummy API GW token (#1068)
    
    * Auto supply a dummy API GW token
    
    * Use package constant and print more clear message
---
 parsers/manifest_parser.go       | 11 +++++++----
 wski18n/i18n_ids.go              |  3 +++
 wski18n/i18n_resources.go        | 22 +++++++++++-----------
 wski18n/resources/en_US.all.json |  4 ++++
 4 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 7b77334..e25cc49 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -52,6 +52,8 @@ const (
 	NATIVE_DOCKER_IMAGE   = "openwhisk/dockerskeleton"
 	PARAM_OPENING_BRACKET = "{"
 	PARAM_CLOSING_BRACKET = "}"
+
+	DUMMY_APIGW_ACCESS_TOKEN = "DUMMY TOKEN"
 )
 
 // Read existing manifest file or create new if none exists
@@ -1148,12 +1150,13 @@ func (dm *YAMLParser) ComposeApiRecordsFromAllPackages(client *whisk.Config,
man
 func (dm *YAMLParser) ComposeApiRecords(client *whisk.Config, packageName string, pkg Package,
manifestPath string) ([]*whisk.ApiCreateRequest, map[string]*whisk.ApiCreateRequestOptions,
error) {
 	var requests = make([]*whisk.ApiCreateRequest, 0)
 
-	// verify APIGW_ACCESS_TOKEN is set before composing APIs
-	// until this point, we dont know whether APIs are specified in manifest or not
+	// supply a dummy API GW token as it is optional
 	if pkg.Apis != nil && len(pkg.Apis) != 0 {
 		if len(client.ApigwAccessToken) == 0 {
-			return nil, nil, wskderrors.NewWhiskClientInvalidConfigError(
-				wski18n.ID_MSG_CONFIG_MISSING_APIGW_ACCESS_TOKEN)
+			warningString := wski18n.T(wski18n.ID_MSG_CONFIG_PROVIDE_DEFAULT_APIGW_ACCESS_TOKEN,
+				map[string]interface{}{wski18n.KEY_DUMMY_TOKEN: DUMMY_APIGW_ACCESS_TOKEN})
+			wskprint.PrintOpenWhiskWarning(warningString)
+			client.ApigwAccessToken = DUMMY_APIGW_ACCESS_TOKEN
 		}
 	}
 
diff --git a/wski18n/i18n_ids.go b/wski18n/i18n_ids.go
index 1203516..cb5b377 100644
--- a/wski18n/i18n_ids.go
+++ b/wski18n/i18n_ids.go
@@ -88,6 +88,7 @@ const (
 	KEY_API_RELATIVE_PATH = "apirelativepath"
 	KEY_DESTINATION       = "destination"
 	KEY_INCLUDE           = "include"
+	KEY_DUMMY_TOKEN       = "dummytoken"
 )
 
 // DO NOT TRANSLATE
@@ -141,6 +142,7 @@ const (
 	ID_MSG_CONFIG_MISSING_APIHOST                       = "msg_config_missing_apihost"
 	ID_MSG_CONFIG_MISSING_NAMESPACE                     = "msg_config_missing_namespace"
 	ID_MSG_CONFIG_MISSING_APIGW_ACCESS_TOKEN            = "msg_config_missing_apigw_access_token"
+	ID_MSG_CONFIG_PROVIDE_DEFAULT_APIGW_ACCESS_TOKEN    = "msg_config_provide_default_apigw_access_token"
 	ID_MSG_CONFIG_INFO_APIHOST_X_host_X_source_X        = "msg_config_apihost_info"
 	ID_MSG_CONFIG_INFO_AUTHKEY_X_source_X               = "msg_config_authkey_info"
 	ID_MSG_CONFIG_INFO_NAMESPACE_X_namespace_X_source_X = "msg_config_namespace_info"
@@ -350,4 +352,5 @@ var I18N_ID_SET = [](string){
 	ID_WARN_RUNTIME_CHANGED_X_runtime_X_action_X,
 	ID_WARN_WHISK_PROPS_DEPRECATED,
 	ID_MSG_CONFIG_MISSING_APIGW_ACCESS_TOKEN,
+	ID_MSG_CONFIG_PROVIDE_DEFAULT_APIGW_ACCESS_TOKEN,
 }
diff --git a/wski18n/i18n_resources.go b/wski18n/i18n_resources.go
index d0e2c37..07b2822 100644
--- a/wski18n/i18n_resources.go
+++ b/wski18n/i18n_resources.go
@@ -92,12 +92,12 @@ func wski18nResourcesDe_deAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/de_DE.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/de_DE.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
 
-var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x3c\x6b\x6f\x1b\x39\x92\xdf\xe7\x57\x14\x06\x0b\xcc\x2c\x20\xcb\xd9\xc5\xe1\xb0\x30\x2e\x07\x78\x13\x67\xd6\x3b\x49\x6c\xd8\xce\x0c\xe6\x12\xa3\x43\x75\x97\x24\xae\xbb\xc9\x5e\x92\x2d\x45\x63\xe8\xbf\x1f\xaa\x48\x76\xb7\x64\xf5\x43\x4e\x06\x77\xf9\x12\x49\x24\xeb\xc5\x62\x3d\x49\x7f\xfc\x0e\xe0\xf1\x3b\x00\x80\xef\x65\xf6\xfd\x19\x7c\x5f\xd8\x45\x52\x1a\x9c\xcb\x2f\x09\x1a\xa3\xcd\xf7\x13\x3f\xea\x8c
[...]
+var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x3c\x6b\x6f\x1b\x39\x92\xdf\xe7\x57\x14\x06\x0b\x64\x16\x90\xe5\xec\xe2\x70\x58\x18\x97\x03\xbc\x89\x33\xeb\x9d\x64\x6c\xd8\xce\x0c\xe6\x12\xa3\x43\x75\x97\x24\xae\xbb\xc9\x5e\x92\x2d\x45\x63\xe8\xbf\x1f\xaa\x48\x76\xb7\x64\xf5\x43\x4e\x06\x77\xf9\x12\x49\x24\xeb\xc5\x62\xb1\x5e\xf4\xc7\xef\x00\x1e\xbf\x03\x00\xf8\x5e\x66\xdf\x9f\xc1\xf7\x85\x5d\x24\xa5\xc1\xb9\xfc\x92\xa0\x31\xda\x7c\x3f\xf1\xa3\xce
[...]
 
 func wski18nResourcesEn_usAllJsonBytes() ([]byte, error) {
 	return bindataRead(
@@ -112,7 +112,7 @@ func wski18nResourcesEn_usAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 20876, mode: os.FileMode(420),
modTime: time.Unix(1560452590, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 21051, mode: os.FileMode(436),
modTime: time.Unix(1568172362, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -132,7 +132,7 @@ func wski18nResourcesEs_esAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/es_ES.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/es_ES.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -152,7 +152,7 @@ func wski18nResourcesFr_frAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/fr_FR.all.json", size: 101, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/fr_FR.all.json", size: 101, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -172,7 +172,7 @@ func wski18nResourcesIt_itAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/it_IT.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/it_IT.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -192,7 +192,7 @@ func wski18nResourcesJa_jaAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/ja_JA.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/ja_JA.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -212,7 +212,7 @@ func wski18nResourcesKo_krAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/ko_KR.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/ko_KR.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -232,7 +232,7 @@ func wski18nResourcesPt_brAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/pt_BR.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/pt_BR.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -252,7 +252,7 @@ func wski18nResourcesZh_hansAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/zh_Hans.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/zh_Hans.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -272,7 +272,7 @@ func wski18nResourcesZh_hantAllJson() (*asset, error) {
 		return nil, err
 	}
 
-	info := bindataFileInfo{name: "wski18n/resources/zh_Hant.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1539631576, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/zh_Hant.all.json", size: 0, mode: os.FileMode(436),
modTime: time.Unix(1566374831, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index 96fb5da..6dff755 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -512,6 +512,10 @@
     "translation": "The apigw access token is not configured.\n"
   },
   {
+    "id": "msg_config_provide_default_apigw_access_token",
+    "translation": "The apigw access token is not configured, use '{{.dummytoken}}' as the
default one.\n"
+  },
+  {
     "id": "msg_verbose_zip_exclude_file_path",
     "translation": "Excluding Path: [{{.path}}]\n"
   },


Mime
View raw message