MCPcopy Create free account
hub / github.com/apache/trafficserver / config_get

Method config_get

src/traffic_ctl/FileConfigCommand.cc:225–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225void
226FileConfigCommand::config_get()
227{
228 auto filename = get_parsed_arguments()->get(COLD_STR).value(); // could be empty which means we should use the default file name
229 auto const &data = get_parsed_arguments()->get(GET_STR);
230 std::string text;
231
232 fix_filename(filename);
233 try {
234 FlatYAMLAccessor::load(YAML::LoadAllFromFile(filename));
235
236 for (auto const &var : data) { // we support multiple get's
237 std::string variable = amend_variable_name(var);
238 auto [found, search] = find_node(variable);
239
240 if (found) {
241 _printer->write_output(swoc::bwprint(text, "{}: {}", var, search.as<std::string>()));
242 } else {
243 _printer->write_output(swoc::bwprint(text, "{} not found", var));
244 }
245 }
246 } catch (YAML::Exception const &ex) {
247 throw std::logic_error(swoc::bwprint(text, "config get error: {}", ex.what()));
248 }
249}
250
251void
252FileConfigCommand::config_set()

Callers

nothing calls this directly

Calls 8

fix_filenameFunction · 0.85
LoadAllFromFileFunction · 0.85
amend_variable_nameFunction · 0.85
loadFunction · 0.50
valueMethod · 0.45
getMethod · 0.45
write_outputMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected