brbzull0 commented on code in PR #12752:
URL: https://github.com/apache/trafficserver/pull/12752#discussion_r2614677920


##########
src/traffic_ctl/CtrlCommands.cc:
##########
@@ -237,6 +255,49 @@ ConfigCommand::config_set()
   _printer->write_output(response);
 }
 
+void
+ConfigCommand::config_reset()
+{
+  auto const &paths = get_parsed_arguments()->get(RESET_STR);
+
+  // Build lookup request - always use REGEX to support partial path matching
+  shared::rpc::RecordLookupRequest lookup_request;
+
+  if (paths.empty() || (paths.size() == 1 && paths[0] == "records")) {
+    lookup_request.emplace_rec(".*", shared::rpc::REGEX, 
shared::rpc::CONFIG_REC_TYPES);
+  } else {
+    for (auto const &path : paths) {
+      // Convert YAML-style path (records.*) to record name format 
(proxy.config.*)
+      auto record_path = yaml_to_record_name(path);
+      lookup_request.emplace_rec(record_path, shared::rpc::REGEX, 
shared::rpc::CONFIG_REC_TYPES);
+    }
+  }
+
+  // Lookup matching records
+  auto lookup_response = invoke_rpc(lookup_request);
+  if (lookup_response.is_error()) {
+    _printer->write_output(lookup_response);
+    return;
+  }
+
+  // Build reset request from modified records (current != default)
+  auto const            &records = 
lookup_response.result.as<shared::rpc::RecordLookUpResponse>();
+  ConfigSetRecordRequest set_request;
+
+  for (auto const &rec : records.recordList) {
+    if (rec.currentValue != rec.defaultValue) {
+      set_request.params.push_back(ConfigSetRecordRequest::Params{rec.name, 
rec.defaultValue});
+    }
+  }
+
+  if (set_request.params.size() == 0) {

Review Comment:
   that's a YAML::Node, no empty function available.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to