diff --git a/commands/action.go b/commands/action.go index 7d4f5fd6..9bd465cb 100644 --- a/commands/action.go +++ b/commands/action.go @@ -199,7 +199,7 @@ func invokeAction( qualifiedName QualifiedName, parameters interface{}, blocking bool, - result bool) (map[string]interface{}, error) { + result bool) (interface{}, error) { // TODO remove all global modifiers Client.Namespace = qualifiedName.GetNamespace() res, _, err := Client.Actions.Invoke( @@ -214,7 +214,7 @@ func printInvocationResponse( qualifiedName QualifiedName, blocking bool, header bool, - result map[string]interface{}, + result interface{}, err error) error { if err == nil { printInvocationMsg(qualifiedName, blocking, header, result, color.Output) @@ -232,13 +232,13 @@ func printInvocationResponse( func printFailedBlockingInvocationResponse( qualifiedName QualifiedName, header bool, - result map[string]interface{}, + result interface{}, err error) error { if isBlockingTimeout(err) { printBlockingTimeoutMsg( qualifiedName.GetNamespace(), qualifiedName.GetEntityName(), - getValueFromJSONResponse(ACTIVATION_ID, result)) + getValueFromResponse(ACTIVATION_ID, result)) return err } else if isApplicationError(err) { printInvocationMsg( @@ -1169,7 +1169,7 @@ func printInvocationMsg( qualifiedName QualifiedName, blocking bool, header bool, - response map[string]interface{}, + response interface{}, outputStream io.Writer) { if header { fmt.Fprintf( @@ -1180,7 +1180,7 @@ func printInvocationMsg( "ok": color.GreenString("ok:"), "namespace": boldString(qualifiedName.GetNamespace()), "name": boldString(qualifiedName.GetEntityName()), - "id": boldString(getValueFromJSONResponse(ACTIVATION_ID, response)), + "id": boldString(getValueFromResponse(ACTIVATION_ID, response)), })) } diff --git a/commands/util.go b/commands/util.go index 3fd930ef..66f6f1e7 100644 --- a/commands/util.go +++ b/commands/util.go @@ -604,17 +604,19 @@ func getChildValueStrings(keyValueArr whisk.KeyValueArr, key string, childKey st return res } -func getValueFromJSONResponse(field string, response map[string]interface{}) interface{} { - var res interface{} - - for key, value := range response { - if key == field { - res = value - break +func getValueFromResponse(field string, response interface{}) interface{} { + if result, ok := response.(map[string]interface{}); ok { + for key, value := range result { + if key == field { + return value + } } } - - return res + if result, ok := response.([]interface{}); ok { + return result + } else { + return "" + } } func logoText() string {