Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/admin-guide/files/strategies.yaml.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Traffic Server uses the :file:`strategies.yaml` file only when one or more
remap lines in remap.config specifies the use of a strategy with the @strategy tag.
remap.config Example::

map http://www.foo.com http://www.bar.com @strategy='mid-tier-north'
map http://www.foo.com http://www.bar.com @strategy=mid-tier-north

After you modify the :file:`strategies.yaml` file, run the :option:`traffic_ctl config reload`
command to apply your changes.
Expand Down
15 changes: 11 additions & 4 deletions plugins/experimental/parent_select/parent_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <iostream>
#include <map>
#include <memory>
#include <filesystem>
#include <fstream>
#include <cstdlib>
#include <cstring>
Expand Down Expand Up @@ -271,10 +272,16 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuff, int errbuff
return TS_ERROR;
}

const char *remap_from = argv[0];
const char *remap_to = argv[1];
const char *config_file_path = argv[2];
const char *strategy_name = argv[3];
const char *remap_from = argv[0];
const char *remap_to = argv[1];
std::filesystem::path config_file_path_obj = argv[2];
const char *strategy_name = argv[3];

if (config_file_path_obj.is_relative()) {
config_file_path_obj = std::filesystem::path(TSConfigDirGet()) / config_file_path_obj;
}

const char *const config_file_path = config_file_path_obj.c_str();

TSDebug(PLUGIN_NAME, "%s %s Loading parent selection strategy file %s for strategy %s", remap_from, remap_to, config_file_path,
strategy_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@
" - *g1"])

ts.Disk.remap_config.AddLine(
"map http://dummy.com http://not_used @plugin=parent_select.so @pparam=" +
ts.Variables.CONFIGDIR +
"/strategies.yaml @pparam=the-strategy")
"map http://dummy.com http://not_used @plugin=parent_select.so @pparam=strategies.yaml @pparam=the-strategy")

tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
#" - passive",
])

suffix = f" @plugin=parent_select.so @pparam={ts.Variables.CONFIGDIR}/strategies.yaml @pparam=the-strategy @plugin=cachekey.so @pparam=--uri-type=remap @pparam=--capture-prefix=/(.*):(.*)/$1/"
suffix = " @plugin=parent_select.so @pparam=strategies.yaml @pparam=the-strategy @plugin=cachekey.so @pparam=--uri-type=remap @pparam=--capture-prefix=/(.*):(.*)/$1/"
ts.Disk.remap_config.AddLines([
"map http://dummy.com http://not_used" + suffix,
"map http://not_used http://also_not_used" + suffix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@
for i in range(num_upstream):
prefix = f"http://ts_upstream{i}:{ts_upstream[i].Variables.port}/"
ts.Disk.remap_config.AddLine(
f"map {prefix} {prefix} @plugin=parent_select.so @pparam=" +
ts.Variables.CONFIGDIR +
"/strategies.yaml @pparam=the-strategy")
f"map {prefix} {prefix} @plugin=parent_select.so @pparam=strategies.yaml @pparam=the-strategy")

tr = Test.AddTestRun()
tr.Processes.Default.StartBefore(server)
Expand Down