This is an automated email from the ASF dual-hosted git repository.
dmeden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 830734f1a3 records.yaml: Improve the output a little bit to make clear
what's the (#11560)
830734f1a3 is described below
commit 830734f1a36475d65806828070d71a2f9ce1e24e
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.
---
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 bc5b89ef43..41c6bb3a2a 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;