openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject [incubator-openwhisk-wskdeploy] branch master updated: fixes #797 (#989)
Date Fri, 21 Sep 2018 20:57:35 GMT
This is an automated email from the ASF dual-hosted git repository.

pdesai 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 01dafd8  fixes #797 (#989)
01dafd8 is described below

commit 01dafd8916d1bc36baa62625bfa9399afff3a830
Author: Kautilya Tripathi <tripathi.kautilya@gmail.com>
AuthorDate: Sat Sep 22 02:27:31 2018 +0530

    fixes #797 (#989)
---
 wskenv/environment.go            | 35 ++++++++++++++++++-------
 wskenv/environment_test.go       |  3 ++-
 wski18n/i18n_ids.go              |  3 +++
 wski18n/i18n_ids_test.go         |  3 ++-
 wski18n/i18n_resources.go        | 56 ++++++++++++++++++++--------------------
 wski18n/resources/en_US.all.json |  5 +++-
 6 files changed, 65 insertions(+), 40 deletions(-)

diff --git a/wskenv/environment.go b/wskenv/environment.go
index 6677c1b..0b36892 100644
--- a/wskenv/environment.go
+++ b/wskenv/environment.go
@@ -21,7 +21,10 @@ import (
 	"os"
 	"reflect"
 	"strings"
-)
+	/** Fixes #797
+	"github.com/apache/incubator-openwhisk-wskdeploy/wski18n"
+	"github.com/apache/incubator-openwhisk-wskdeploy/wskprint"
+	**/)
 
 // Test if a string
 func isValidEnvironmentVar(value string) bool {
@@ -72,10 +75,17 @@ func InterpolateStringWithEnvVar(key interface{}) interface{} {
 					thisValue = os.Getenv(substr)
 					// TODO(920) disabling the warning for now, since we want to get rid of it eventually
 					// TODO(920) please add/remove this based on what we decide in issue #920
-					//if thisValue == "" {
-					// TODO(797) i18n
-					//wskprint.PrintlnOpenWhiskWarning("Missing Environment Variable " + substr + ".")
-					//}
+
+					/** Fixes #797
+					if thisValue == "" {
+						warningString := wski18n.T(
+							wski18n.ID_WARN_MISSING_ENVIRONMENT_VARIABLE,
+							map[string]interface{}{
+								wski18n.KEY_VALUE: keystr})
+						wskprint.PrintOpenWhiskWarning(warningString)
+					}
+					**/
+
 					keystr = strings.Replace(keystr, "$"+substr, thisValue, -1)
 					//if the substr is a ${ENV_VAR}
 					// return interpolated string using env. variable
@@ -83,10 +93,17 @@ func InterpolateStringWithEnvVar(key interface{}) interface{} {
 					thisValue = os.Getenv(substr)
 					// TODO(920) disabling the warning for now, since we want to get rid of it eventually
 					// TODO(920) please add/remove this based on what we decide in issue #920
-					//if thisValue == "" {
-					// TODO(797) i18n
-					//wskprint.PrintlnOpenWhiskWarning("Missing Environment Variable " + substr + ".")
-					//}
+
+					/** Fixes #797
+					if thisValue == "" {
+						warningString := wski18n.T(
+							wski18n.ID_WARN_MISSING_ENVIRONMENT_VARIABLE,
+							map[string]interface{}{
+								wski18n.KEY_VALUE: keystr})
+						wskprint.PrintOpenWhiskWarning(warningString)
+					}
+					**/
+
 					keystr = strings.Replace(keystr, "${"+substr+"}", thisValue, -1)
 				}
 			}
diff --git a/wskenv/environment_test.go b/wskenv/environment_test.go
index bf73cc2..6a069ed 100644
--- a/wskenv/environment_test.go
+++ b/wskenv/environment_test.go
@@ -19,9 +19,10 @@ package wskenv
 
 import (
 	"fmt"
-	"github.com/stretchr/testify/assert"
 	"os"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 // The dollar sign test cases.
diff --git a/wski18n/i18n_ids.go b/wski18n/i18n_ids.go
index 041aff8..0cdd2dd 100644
--- a/wski18n/i18n_ids.go
+++ b/wski18n/i18n_ids.go
@@ -236,6 +236,9 @@ const (
 	ID_WARN_API_MISSING_WEB_ACTION_X_action_X_api_X           = "msg_warn_api_missing_web_action"
 	ID_WARN_API_MISSING_WEB_SEQUENCE_X_sequence_X_api_X       = "msg_warn_api_missing_web_sequence"
 	ID_WARN_API_INVALID_RESPONSE_TYPE                         = "msg_warn_api_invalid_response_type"
+	/** Fixes #797
+	ID_WARN_MISSING_ENVIRONMENT_VARIABLE                      = "msg_warn_missing_environment_variable"
+	**/
 
 	// Verbose (Debug/Trace) messages
 	ID_DEBUG_PROJECT_SEARCH_X_path_X_key_X                = "msg_dbg_searching_project_directory"
diff --git a/wski18n/i18n_ids_test.go b/wski18n/i18n_ids_test.go
index cfd98b8..fb75d48 100644
--- a/wski18n/i18n_ids_test.go
+++ b/wski18n/i18n_ids_test.go
@@ -20,8 +20,9 @@
 package wski18n
 
 import (
-	"github.com/stretchr/testify/assert"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 /*
diff --git a/wski18n/i18n_resources.go b/wski18n/i18n_resources.go
index e397a0b..72285a7 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/de_DE.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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\x8f\x1b\x37\x92\xdf\xfd\x2b\x0a\xc1\x02\x4e\x80\x19\x4d\xb2\x87\x03\x0e\xc6\xf9\x80\x39\x7b\x92\x9d\x8d\xed\x31\xc6\xe3\x0d\x02\xdb\x68\x53\xdd\x25\x89\xab\x6e\xb2\x97\x64\x4b\x56\x06\xfa\xef\x87\x2a\x92\xdd\xad\x47\x3f\x24\x3b\xb8\xf5\x17\x4b\x22\x59\x2f\x16\xeb\x49\xce\x87\x27\x00\x8f\x4f\x00\x00\xbe\x93\xd9\x77\xcf\xe0\xbb\xc2\xce\x93\xd2\xe0\x4c\x7e\x49\xd0\x18\x6d\xbe\xbb\xf0\xa3\xce\x08
[...]
+var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x7c\x7b\x6f\x1b\xb7\x96\xf8\xff\xf9\x14\x07\xc5\x05\xd2\x02\xb6\xdc\xde\x1f\x7e\xc0\x22\xd8\x2c\xe0\x4d\xdc\x5e\xdf\x26\x71\xe0\x38\x2d\x8a\x24\x98\x50\x33\x47\x12\xaf\x67\xc8\xb9\x24\x47\x8a\x6a\xe8\xbb\x2f\xce\x21\x39\x0f\x59\xf3\x90\x92\x62\x37\xff\x44\x12\xc9\xf3\xe2\xe1\x79\x92\xfe\xf0\x04\xe0\xe1\x09\x00\xc0\x77\x32\xfb\xee\x19\x7c\x57\xd8\x65\x52\x1a\x5c\xc8\x2f\x09\x1a\xa3\xcd\x77\x67\x7e\xd4
[...]
 
 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: 19618, mode: os.FileMode(436),
modTime: time.Unix(1536397293, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 19741, mode: os.FileMode(420),
modTime: time.Unix(1537092250, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/es_ES.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/fr_FR.all.json", size: 101, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/it_IT.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/ja_JA.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/ko_KR.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/pt_BR.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/zh_Hans.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 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(436),
modTime: time.Unix(1536397114, 0)}
+	info := bindataFileInfo{name: "wski18n/resources/zh_Hant.all.json", size: 0, mode: os.FileMode(420),
modTime: time.Unix(1537087727, 0)}
 	a := &asset{bytes: bytes, info: info}
 	return a, nil
 }
@@ -329,14 +329,14 @@ func AssetNames() []string {
 
 // _bindata is a table, holding each asset generator, mapped to its name.
 var _bindata = map[string]func() (*asset, error){
-	"wski18n/resources/de_DE.all.json":   wski18nResourcesDe_deAllJson,
-	"wski18n/resources/en_US.all.json":   wski18nResourcesEn_usAllJson,
-	"wski18n/resources/es_ES.all.json":   wski18nResourcesEs_esAllJson,
-	"wski18n/resources/fr_FR.all.json":   wski18nResourcesFr_frAllJson,
-	"wski18n/resources/it_IT.all.json":   wski18nResourcesIt_itAllJson,
-	"wski18n/resources/ja_JA.all.json":   wski18nResourcesJa_jaAllJson,
-	"wski18n/resources/ko_KR.all.json":   wski18nResourcesKo_krAllJson,
-	"wski18n/resources/pt_BR.all.json":   wski18nResourcesPt_brAllJson,
+	"wski18n/resources/de_DE.all.json": wski18nResourcesDe_deAllJson,
+	"wski18n/resources/en_US.all.json": wski18nResourcesEn_usAllJson,
+	"wski18n/resources/es_ES.all.json": wski18nResourcesEs_esAllJson,
+	"wski18n/resources/fr_FR.all.json": wski18nResourcesFr_frAllJson,
+	"wski18n/resources/it_IT.all.json": wski18nResourcesIt_itAllJson,
+	"wski18n/resources/ja_JA.all.json": wski18nResourcesJa_jaAllJson,
+	"wski18n/resources/ko_KR.all.json": wski18nResourcesKo_krAllJson,
+	"wski18n/resources/pt_BR.all.json": wski18nResourcesPt_brAllJson,
 	"wski18n/resources/zh_Hans.all.json": wski18nResourcesZh_hansAllJson,
 	"wski18n/resources/zh_Hant.all.json": wski18nResourcesZh_hantAllJson,
 }
@@ -380,18 +380,17 @@ type bintree struct {
 	Func     func() (*asset, error)
 	Children map[string]*bintree
 }
-
 var _bintree = &bintree{nil, map[string]*bintree{
 	"wski18n": &bintree{nil, map[string]*bintree{
 		"resources": &bintree{nil, map[string]*bintree{
-			"de_DE.all.json":   &bintree{wski18nResourcesDe_deAllJson, map[string]*bintree{}},
-			"en_US.all.json":   &bintree{wski18nResourcesEn_usAllJson, map[string]*bintree{}},
-			"es_ES.all.json":   &bintree{wski18nResourcesEs_esAllJson, map[string]*bintree{}},
-			"fr_FR.all.json":   &bintree{wski18nResourcesFr_frAllJson, map[string]*bintree{}},
-			"it_IT.all.json":   &bintree{wski18nResourcesIt_itAllJson, map[string]*bintree{}},
-			"ja_JA.all.json":   &bintree{wski18nResourcesJa_jaAllJson, map[string]*bintree{}},
-			"ko_KR.all.json":   &bintree{wski18nResourcesKo_krAllJson, map[string]*bintree{}},
-			"pt_BR.all.json":   &bintree{wski18nResourcesPt_brAllJson, map[string]*bintree{}},
+			"de_DE.all.json": &bintree{wski18nResourcesDe_deAllJson, map[string]*bintree{}},
+			"en_US.all.json": &bintree{wski18nResourcesEn_usAllJson, map[string]*bintree{}},
+			"es_ES.all.json": &bintree{wski18nResourcesEs_esAllJson, map[string]*bintree{}},
+			"fr_FR.all.json": &bintree{wski18nResourcesFr_frAllJson, map[string]*bintree{}},
+			"it_IT.all.json": &bintree{wski18nResourcesIt_itAllJson, map[string]*bintree{}},
+			"ja_JA.all.json": &bintree{wski18nResourcesJa_jaAllJson, map[string]*bintree{}},
+			"ko_KR.all.json": &bintree{wski18nResourcesKo_krAllJson, map[string]*bintree{}},
+			"pt_BR.all.json": &bintree{wski18nResourcesPt_brAllJson, map[string]*bintree{}},
 			"zh_Hans.all.json": &bintree{wski18nResourcesZh_hansAllJson, map[string]*bintree{}},
 			"zh_Hant.all.json": &bintree{wski18nResourcesZh_hantAllJson, map[string]*bintree{}},
 		}},
@@ -444,3 +443,4 @@ func _filePath(dir, name string) string {
 	cannonicalName := strings.Replace(name, "\\", "/", -1)
 	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
 }
+
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index 9545ea2..06e4ed5 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -387,7 +387,6 @@
     "id": "msg_err_runtime_parser_error",
     "translation": "Failed to retrieve runtimes {{.err}}."
   },
-
   {
     "id": "WARNINGS",
     "translation": "================= WARNINGS ==================="
@@ -485,6 +484,10 @@
     "translation": "API [{{.api}}] with path parameters [{{.apirelativepath}}] is required
to have http as response type. Changing response type from [{{.response}}] to http for [{{.api}}]."
   },
   {
+    "id": "msg_warn_missing_environment_variable",
+    "translation": "Missing Environment Variable [{{.value}}]."
+  },
+  {
     "id": "DEBUG",
     "translation": "================= DEBUG ==================="
   },


Mime
View raw message