bneradt commented on code in PR #13456:
URL: https://github.com/apache/trafficserver/pull/13456#discussion_r3908606818


##########
src/traffic_ctl/ConvertConfigCommand.cc:
##########
@@ -65,6 +74,51 @@ ConvertConfigCommand::ConvertConfigCommand(ts::Arguments 
*args) : CtrlCommand(ar
   }
 }
 
+void
+ConvertConfigCommand::convert_cache()
+{
+  config::CacheConfigParser                 parser;
+  config::ConfigResult<config::CacheConfig> result = parser.parse(_input_file);
+
+  if (result.file_not_found || !result.ok()) {
+    std::string error_msg = "Failed to parse input file '" + _input_file + "'";
+    if (!result.errata.empty()) {
+      error_msg += ": ";
+      error_msg += std::string(result.errata.front().text());
+    }
+    _printer->write_output(error_msg);
+    return;
+  }
+
+  config::CacheConfigMarshaller marshaller;
+  std::string const             yaml_output = marshaller.to_yaml(result.value);
+
+  if (result.value.size() > 1) {
+    std::cerr << "Warning: cache.config can combine actions from overlapping 
rules, but cache.yaml uses only the first matching "
+                 "rule. Review the converted rule order and merge actions 
where needed.\n";
+  }

Review Comment:
   Addressed in 6e3ab0e5b3. The cache parser now reports the detected input 
format, and traffic_ctl emits the additive-semantics warning only for legacy 
cache.config input with multiple rules. I added parser format assertions and an 
AuTest covering YAML-to-YAML conversion without the warning. The full Debug 
build/install, focused parser tests (65 assertions), convert_cache AuTest, and 
warnings-as-errors docs build all pass in asfats5.



-- 
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