ningyougang commented on code in PR #516:
URL: https://github.com/apache/openwhisk-cli/pull/516#discussion_r950949572


##########
commands/util.go:
##########
@@ -604,16 +604,20 @@ func getChildValueStrings(keyValueArr whisk.KeyValueArr, 
key string, childKey st
        return res
 }
 
-func getValueFromJSONResponse(field string, response map[string]interface{}) 
interface{} {
+func getValueFromJSONResponse(field string, response interface{}) interface{} {
        var res interface{}
 
-       for key, value := range response {
-               if key == field {
-                       res = value
-                       break
+       if result, ok := response.(map[string]interface{}); ok {
+               for key, value := range result {
+                       if key == field {
+                               res = value
+                               break
+                       }
                }
        }
-
+       if result, ok := response.([]interface{}); ok {

Review Comment:
   I tested in such case (btw, i stopped all invokers containers)
   
![image](https://user-images.githubusercontent.com/11749867/185824239-edb27481-f5c6-4b84-a5ce-430aa916352c.png)
   
   The result is nil
   
![image](https://user-images.githubusercontent.com/11749867/185824343-ff2fef7a-79ab-46de-aeaf-5b5d3f4d3cd9.png)
   
   Finally is
   
![image](https://user-images.githubusercontent.com/11749867/185824375-d0ac4bd0-bb2e-4c99-b694-58fc181b9033.png)
   
   If i added `sleep 61s` for that action and make all invokers up again, the 
result is
   
![image](https://user-images.githubusercontent.com/11749867/185824455-e44b3419-30aa-488a-b66c-3879f8dd7e32.png)
   
   For normally hello-array action with this pr, the result is
   
![image](https://user-images.githubusercontent.com/11749867/185824674-d916ac2c-5b61-4c3b-adf7-29372395ac47.png)
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to