[GitHub] mrutkows commented on a change in pull request #766: adding support for using env. variables in inputs JSON

2018-03-07 Thread GitBox
mrutkows commented on a change in pull request #766: adding support for using 
env. variables in inputs JSON
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/766#discussion_r172929604
 
 

 ##
 File path: parsers/manifest_parser_test.go
 ##
 @@ -1032,7 +1054,7 @@ func TestParseManifestForJSONParams(t *testing.T) {
assert.Equal(t, expectedResult, actualResult, 
TEST_MSG_ACTION_FUNCTION_RUNTIME_MISMATCH)
 
// validate the number of inputs to this action
-   expectedResult = strconv.FormatInt(6, 10)
+   expectedResult = strconv.FormatInt(8, 10)
 
 Review comment:
   2 new unit tests


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mrutkows commented on a change in pull request #766: adding support for using env. variables in inputs JSON

2018-03-07 Thread GitBox
mrutkows commented on a change in pull request #766: adding support for using 
env. variables in inputs JSON
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/766#discussion_r172929391
 
 

 ##
 File path: parsers/manifest_parser_test.go
 ##
 @@ -304,7 +304,7 @@ func TestParseManifestForMultiLineParams(t *testing.T) {
assert.Equal(t, expectedResult, actualResult, 
TEST_MSG_ACTION_FUNCTION_RUNTIME_MISMATCH)
 
// test # input params
-   expectedResult = strconv.FormatInt(10, 10)
+   expectedResult = strconv.FormatInt(13, 10)
 
 Review comment:
   3 new unit tests.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mrutkows commented on a change in pull request #766: adding support for using env. variables in inputs JSON

2018-03-07 Thread GitBox
mrutkows commented on a change in pull request #766: adding support for using 
env. variables in inputs JSON
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/766#discussion_r172930215
 
 

 ##
 File path: wskenv/environment.go
 ##
 @@ -63,15 +63,21 @@ func InterpolateStringWithEnvVar(key interface{}) 
interface{} {
return c == '$' || c == '{' || c == '}'
}
for _, substr := range strings.FieldsFunc(keystr, f) {
-   //if the substr is a $ENV_VAR
-   if strings.Contains(keystr, "$"+substr) {
+   //if the substr is a $${ENV_VAR}
+   // return ${ENV_VAR}
+   if strings.Contains(keystr, "$${"+substr+"}") {
+   keystr = strings.Replace(keystr, 
"$${"+substr+"}", "${"+substr+"}", -1)
+   //if the substr is a $ENV_VAR
 
 Review comment:
   hate gofmt and comment alignment


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mrutkows commented on a change in pull request #766: adding support for using env. variables in inputs JSON

2018-03-07 Thread GitBox
mrutkows commented on a change in pull request #766: adding support for using 
env. variables in inputs JSON
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/766#discussion_r172929780
 
 

 ##
 File path: parsers/parameters.go
 ##
 @@ -322,7 +325,7 @@ func ResolveParameter(paramName string, param *Parameter, 
filePath string) (inte
}
 
// JSON - Handle both cases, where value 1) is a string containing 
JSON, 2) is a map of JSON
-   if param.Type == "json" {
+   if param.Value != nil && param.Type == "json" {
 
 Review comment:
   good catch.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] mrutkows commented on a change in pull request #766: adding support for using env. variables in inputs JSON

2018-03-07 Thread GitBox
mrutkows commented on a change in pull request #766: adding support for using 
env. variables in inputs JSON
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/pull/766#discussion_r172930016
 
 

 ##
 File path: tests/dat/manifest_validate_multiline_params.yaml
 ##
 @@ -32,6 +32,15 @@ packages:
 param_string_type_and_value_only:
 type: string
 value: foo
+param_json_type_and_value_only_1:
+type: json
+value: '{ "name": "Sam", "place": "Shire" }'
+param_json_type_and_value_only_2:
+type: json
+value: { "name": "${USERNAME}", "password": 
"${PASSWORD}" }
+param_json_type_and_value_only_3:
+type: json
+value: { "name": "$${USERNAME}", "password": 
"$${PASSWORD}" }
 
 Review comment:
   Thanks for this.  Did we open an spec/docs issue to document this new syntax 
for string literals (ala Kube, etc.)?


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:
us...@infra.apache.org


With regards,
Apache Git Services