diff --git a/scripts/policy/frameworks/management/controller/main.zeek b/scripts/policy/frameworks/management/controller/main.zeek index 77c8ea25cd..e951d3d35e 100644 --- a/scripts/policy/frameworks/management/controller/main.zeek +++ b/scripts/policy/frameworks/management/controller/main.zeek @@ -695,7 +695,8 @@ event Management::Agent::API::notify_log(instance: string, msg: string, node: st event Management::Agent::API::deploy_response(reqid: string, results: Management::ResultVec) { - Management::Log::info(fmt("rx Management::Agent::API::deploy_response %s", reqid)); + Management::Log::info(fmt("rx Management::Agent::API::deploy_response %s %s", + reqid, Management::result_vec_to_string(results))); # Retrieve state for the request we just got a response to local areq = Management::Request::lookup(reqid); diff --git a/scripts/policy/frameworks/management/request.zeek b/scripts/policy/frameworks/management/request.zeek index e291e02260..676c65f6bd 100644 --- a/scripts/policy/frameworks/management/request.zeek +++ b/scripts/policy/frameworks/management/request.zeek @@ -146,20 +146,12 @@ function is_null(request: Request): bool function to_string(request: Request): string { - local results: string_vec; - local res: Management::Result; local parent_id = ""; if ( request?$parent_id ) parent_id = fmt(" (via %s)", request$parent_id); - for ( idx in request$results ) - { - res = request$results[idx]; - results[|results|] = Management::result_to_string(res); - } - return fmt("[request %s%s %s, results: %s]", request$id, parent_id, request$finished ? "finished" : "pending", - join_string_vec(results, ", ")); + Management::result_vec_to_string(request$results)); } diff --git a/scripts/policy/frameworks/management/types.zeek b/scripts/policy/frameworks/management/types.zeek index 7632cc0247..f28706a313 100644 --- a/scripts/policy/frameworks/management/types.zeek +++ b/scripts/policy/frameworks/management/types.zeek @@ -124,6 +124,10 @@ export { ## Given a :zeek:see:`Management::Result` record, ## this function returns a string summarizing it. global result_to_string: function(res: Result): string; + + ## Given a vector of :zeek:see:`Management::Result` records, + ## this function returns a string summarizing them. + global result_vec_to_string: function(res: ResultVec): string; } function result_to_string(res: Result): string @@ -151,3 +155,13 @@ function result_to_string(res: Result): string return result; } + +function result_vec_to_string(res: ResultVec): string + { + local ret: vector of string; + + for ( idx in res ) + ret += result_to_string(res[idx]);; + + return join_string_vec(ret, ", "); + }