| 47 | DbgCtl dbg_ctl{"filemanager"}; |
| 48 | |
| 49 | swoc::Errata |
| 50 | process_config_update(std::string const &fileName, std::string const &configName) |
| 51 | { |
| 52 | Dbg(dbg_ctl, "Config update requested for '%s'. [%s]", fileName.empty() ? "Unknown" : fileName.c_str(), |
| 53 | configName.empty() ? "No config record associated" : configName.c_str()); |
| 54 | swoc::Errata ret; |
| 55 | // TODO: make sure records holds the name after change, if not we should change it. |
| 56 | if (fileName == ts::filename::RECORDS) { |
| 57 | if (auto zret = RecReadYamlConfigFile(); zret) { |
| 58 | RecConfigWarnIfUnregistered(); |
| 59 | } else { |
| 60 | ret.note("Error reading {}", fileName).note(zret); |
| 61 | } |
| 62 | } else if (!configName.empty()) { // Could be the case we have a child file to reload with no related config record. |
| 63 | RecT rec_type; |
| 64 | if (auto r = RecGetRecordType(configName.c_str(), &rec_type); r == REC_ERR_OKAY && rec_type == RECT_CONFIG) { |
| 65 | RecSetSyncRequired(configName.c_str()); |
| 66 | } else { |
| 67 | Dbg(dbg_ctl, "Couldn't set RecSetSyncRequired for %s - RecGetRecordType ret = %d", configName.c_str(), r); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return ret; |
| 72 | } |
| 73 | |
| 74 | // JSONRPC endpoint defs. |
| 75 | const std::string CONFIG_REGISTRY_KEY_STR{"config_registry"}; |
nothing calls this directly
no test coverage detected