From 3ac5fdfc599c9b58bf8dc01879fc60a27e2b49f0 Mon Sep 17 00:00:00 2001 From: Christian Kreibich Date: Tue, 14 Jun 2022 14:40:56 -0700 Subject: [PATCH] Management framework: trivial changes and comment-only rewording --- .../frameworks/management/controller/api.zeek | 18 +++++++++--------- .../frameworks/management/controller/main.zeek | 18 +++++++++--------- .../policy/frameworks/management/request.zeek | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/policy/frameworks/management/controller/api.zeek b/scripts/policy/frameworks/management/controller/api.zeek index b0897ed20a..3235de8598 100644 --- a/scripts/policy/frameworks/management/controller/api.zeek +++ b/scripts/policy/frameworks/management/controller/api.zeek @@ -1,7 +1,7 @@ ##! The event API of cluster controllers. Most endpoints consist of event pairs, -##! where the controller answers a zeek-client request event with a -##! corresponding response event. Such event pairs share the same name prefix -##! and end in "_request" and "_response", respectively. +##! where the controller answers the client's request event with a corresponding +##! response event. Such event pairs share the same name prefix and end in +##! "_request" and "_response", respectively. @load policy/frameworks/management/types @@ -9,11 +9,11 @@ module Management::Controller::API; export { ## A simple versioning scheme, used to track basic compatibility of - ## controller, agents, and zeek-client. + ## controller, agents, and the client. const version = 1; - ## zeek-client sends this event to request a list of the currently + ## The client sends this event to request a list of the currently ## peered agents/instances. ## ## reqid: a request identifier string, echoed in the response event. @@ -32,7 +32,7 @@ export { result: Management::Result); - ## zeek-client sends this event to establish a new cluster configuration, + ## The client sends this event to establish a new cluster configuration, ## including the full cluster topology. The controller processes the update ## and relays it to the agents. Once each has responded (or a timeout occurs) ## the controller sends a corresponding response event back to the client. @@ -57,7 +57,7 @@ export { result: Management::ResultVec); - ## zeek-client sends this event to retrieve the currently deployed + ## The client sends this event to retrieve the currently deployed ## cluster configuration. ## ## reqid: a request identifier string, echoed in the response event. @@ -78,7 +78,7 @@ export { result: Management::Result); - ## zeek-client sends this event to request a list of + ## The client sends this event to request a list of ## :zeek:see:`Management::NodeStatus` records that capture ## the status of Supervisor-managed nodes running on the cluster's ## instances. @@ -102,7 +102,7 @@ export { result: Management::ResultVec); - ## zeek-client sends this event to retrieve the current value of a + ## The client sends this event to retrieve the current value of a ## variable in Zeek's global namespace, referenced by the given ## identifier (i.e., variable name). The controller asks all agents ## to retrieve this value from each cluster node, accumulates the diff --git a/scripts/policy/frameworks/management/controller/main.zeek b/scripts/policy/frameworks/management/controller/main.zeek index ef6047e3bf..b9edef3fed 100644 --- a/scripts/policy/frameworks/management/controller/main.zeek +++ b/scripts/policy/frameworks/management/controller/main.zeek @@ -91,7 +91,7 @@ global drop_instance: function(inst: Management::Instance); # Helpers to simplify handling of config records. global null_config: function(): Management::Configuration; -global is_null_config: function(config: Management::Configuration): bool; +global config_is_null: function(config: Management::Configuration): bool; # Returns list of names of nodes in the given configuration that require a # listening port. Returns empty list if the config has no such nodes. @@ -505,7 +505,7 @@ function find_endpoint(id: string): Broker::EndpointInfo return Broker::EndpointInfo($id=""); } -function is_null_config(config: Management::Configuration): bool +function config_is_null(config: Management::Configuration): bool { return config$id == ""; } @@ -654,7 +654,6 @@ event Management::Agent::API::agent_welcome_response(reqid: string, result: Mana # An agent we've been waiting to hear back from is ready for cluster # work. Double-check we still want it, otherwise drop it. - if ( ! result$success || result$instance !in g_instances ) { Management::Log::info(fmt( @@ -897,7 +896,7 @@ event Management::Controller::API::get_configuration_request(reqid: string) local res = Management::Result($reqid=reqid); - if ( is_null_config(g_config_current) ) + if ( config_is_null(g_config_current) ) { # We don't have a live configuration yet. res$success = F; @@ -1247,11 +1246,12 @@ event zeek_init() # set_configuration request. g_config_current = null_config(); - # The controller always listens -- it needs to be able to respond to the - # Zeek client. This port is also used by the agents if they connect to - # the client. The client doesn't automatically establish or accept - # connectivity to agents: agents are defined and communicated with as - # defined via configurations defined by the client. + # The controller always listens: it needs to be able to respond to + # clients connecting to it, as well as agents if they connect to the + # controller. The controller does not automatically connect to any + # agents; instances with listening agents are conveyed to the controller + # via configurations uploaded by a client, with connections established + # upon deployment. local cni = Management::Controller::network_info(); diff --git a/scripts/policy/frameworks/management/request.zeek b/scripts/policy/frameworks/management/request.zeek index 86de3ea0fd..e291e02260 100644 --- a/scripts/policy/frameworks/management/request.zeek +++ b/scripts/policy/frameworks/management/request.zeek @@ -161,5 +161,5 @@ function to_string(request: Request): string return fmt("[request %s%s %s, results: %s]", request$id, parent_id, request$finished ? "finished" : "pending", - join_string_vec(results, ",")); + join_string_vec(results, ", ")); }