You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by dm...@apache.org on 2023/02/20 17:09:19 UTC
[trafficserver] branch master updated: records.yaml: Make sure we fail if we found a legacy records.config file. (#9435)
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 352a0884d records.yaml: Make sure we fail if we found a legacy records.config file. (#9435)
352a0884d is described below
commit 352a0884d1838c44223f14e8aa1144f258451fee
Author: Damian Meden <dm...@apache.org>
AuthorDate: Mon Feb 20 17:09:12 2023 +0000
records.yaml: Make sure we fail if we found a legacy records.config file. (#9435)
---
.../tools/converting-records-to-yaml.en.rst | 10 +++----
src/records/RecCore.cc | 9 +++---
tests/gold_tests/records/old_config_fail.test.py | 32 ----------------------
3 files changed, 9 insertions(+), 42 deletions(-)
diff --git a/doc/admin-guide/tools/converting-records-to-yaml.en.rst b/doc/admin-guide/tools/converting-records-to-yaml.en.rst
index 629db4551..14e5fb89e 100644
--- a/doc/admin-guide/tools/converting-records-to-yaml.en.rst
+++ b/doc/admin-guide/tools/converting-records-to-yaml.en.rst
@@ -242,16 +242,14 @@ Now the records parser knows the type of the non core records.
Final Notes
===========
-Internally ATS still uses the record style names, querying any record can still
+Internally ATS still uses variables with record style names, querying any record can still
be done as usual. Either by using the ATS API or by using :program:`traffic_ctl`.
-This implementation will only accept a ``records.yaml`` config file, if not found the
-defaults will be used. If a ``record.config`` file is found in the config directory
-a warning will be shown, the legacy file should be removed.
-This is done to avoid someone having the legacy file thinking it is the current one.
+ATS only accepts a :file:`records.yaml` config file, if a legacy file ``records.config`` is found
+then ATS will fail to start.
.. code-block:: bash
- traffic_server WARNING: Found a legacy config file. /home/to/ats/config/records.config
+ traffic_server WARNING: **** Found a legacy config file (/your/ats/records.config). Please remove it and migrate to the new YAML format before continuing. ****
diff --git a/src/records/RecCore.cc b/src/records/RecCore.cc
index 3b1609a64..a62e2560c 100644
--- a/src/records/RecCore.cc
+++ b/src/records/RecCore.cc
@@ -223,12 +223,13 @@ RecCoreInit(RecModeT mode_type, Diags *_diags)
g_rec_config_fpath = ats_stringdup(RecConfigReadConfigPath(nullptr, ts::filename::RECORDS));
- // Make sure there is no legacy file, if so we fail. This is to avoid issues with someone not knowing
- // that we now are using records.yaml
+ // Make sure there is no legacy file, if so we drop a BIG WARNING and fail.
+ // This is to avoid issues with someone ignoring that we now use records.yaml
ts::file::path old_config{RecConfigReadConfigPath(nullptr, "records.config")};
if (ts::file::exists(old_config)) {
- RecLog(DL_Warning, "Found a legacy config file. %s", old_config.c_str());
- return REC_ERR_FAIL;
+ RecLog(DL_Fatal,
+ "**** Found a legacy config file (%s). Please remove it and migrate to the new YAML format before continuing. ****",
+ old_config.c_str());
}
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
diff --git a/tests/gold_tests/records/old_config_fail.test.py b/tests/gold_tests/records/old_config_fail.test.py
deleted file mode 100644
index 66ffa6a18..000000000
--- a/tests/gold_tests/records/old_config_fail.test.py
+++ /dev/null
@@ -1,32 +0,0 @@
-'''
-'''
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-Test.Summary = 'Test old config ATS startup'
-
-ts = Test.MakeATSProcess("ts")
-ts.Disk.MakeConfigFile('records.config').AddLine('dummy file!')
-
-
-tr = Test.AddTestRun("Start ATS with both, new(yaml) and legacy records config")
-tr.Processes.Default.Command = 'echo 1'
-tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.StartBefore(ts)
-
-ts.Disk.traffic_out.Content = Testers.ContainsExpression(
- "WARNING: Found a legacy config file",
- "It should fail when legacy config is found.")