This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit f60f74ddee61339c89b5575327a349cc3c3dfe64
Author: Damian Meden <[email protected]>
AuthorDate: Mon Jul 29 10:44:58 2024 +0200

    records.yaml: Improve the output a little bit to make clear what's the 
(#11560)
    
    outcome in some error scenarios.
    
    (cherry picked from commit 830734f1a36475d65806828070d71a2f9ce1e24e)
---
 doc/admin-guide/files/records.yaml.en.rst | 4 +++-
 src/records/RecCore.cc                    | 3 ++-
 src/records/RecYAMLDecoder.cc             | 5 +++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index 21de9f5be5..b7759762a3 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -46,7 +46,9 @@ YAML structure
 ==============
 
 All fields are located inside the ``records``` root node. ATS supports reading 
multiple documents from
-the same YAML stream, subsequent documents overrides earlier fields.
+the same YAML stream, subsequent documents overrides earlier fields. If there 
is any error reading a
+particular node the default value(s) will be used.
+
 
 
 .. code-block:: yaml
diff --git a/src/records/RecCore.cc b/src/records/RecCore.cc
index 81fcfa1037..ec83d64cbd 100644
--- a/src/records/RecCore.cc
+++ b/src/records/RecCore.cc
@@ -244,7 +244,8 @@ RecCoreInit(Diags *_diags)
     RecLog(DL_Note, "records parsing completed.");
     if (!err.empty()) {
       std::string text;
-      RecLog(DL_Note, "%s", swoc::bwprint(text, "{}", err).c_str());
+      RecLog(DL_Warning, "%s",
+             swoc::bwprint(text, "We have found the following issues when 
reading the records node:\n {}", err).c_str());
     }
   } else {
     RecLog(DL_Note, "%s does not exist.", g_rec_config_fpath);
diff --git a/src/records/RecYAMLDecoder.cc b/src/records/RecYAMLDecoder.cc
index d32bf12994..e708a11948 100644
--- a/src/records/RecYAMLDecoder.cc
+++ b/src/records/RecYAMLDecoder.cc
@@ -146,7 +146,7 @@ ParseRecordsFromYAML(YAML::Node root, RecYAMLNodeHandler 
handler, bool lock /*fa
 
   swoc::Errata errata;
   if (YAML::NodeType::Map != root.Type()) {
-    return swoc::Errata(ERRATA_NOTE, "Node is expected to be a map, got '{}' 
instead.", root.Type());
+    return swoc::Errata(ERRATA_ERROR, "Node is expected to be a map, got '{}' 
instead.", root.Type());
   }
 
   if (auto ts = root[RECORD_YAML_ROOT_STR]; ts.size()) {
@@ -154,7 +154,8 @@ ParseRecordsFromYAML(YAML::Node root, RecYAMLNodeHandler 
handler, bool lock /*fa
       detail::flatten_node({n.first, n.second, CONFIG_RECORD_PREFIX}, handler, 
errata);
     }
   } else {
-    return swoc::Errata(ERRATA_NOTE, "'records' root key not present or no 
fields to read.");
+    return swoc::Errata(ERRATA_ERROR, "'{}' root key not present or no fields 
to read. Default values will be used",
+                        RECORD_YAML_ROOT_STR);
   }
 
   return errata;

Reply via email to