loads host status persistent store file
| 161 | |
| 162 | // loads host status persistent store file |
| 163 | void |
| 164 | HostStatus::loadFromPersistentStore() |
| 165 | { |
| 166 | YAML::Node records; |
| 167 | std::string fileStore = getHostStatusPersistentFilePath(); |
| 168 | if (access(fileStore.c_str(), R_OK) == 0) { |
| 169 | try { |
| 170 | records = YAML::LoadFile(fileStore.c_str()); |
| 171 | YAML::Node statusList = records["statuses"]; |
| 172 | for (YAML::const_iterator it = statusList.begin(); it != statusList.end(); ++it) { |
| 173 | const YAML::Node &host = *it; |
| 174 | std::string hostName = host[HOST_NAME_KEY].as<std::string>(); |
| 175 | std::string status = host[STATUS_KEY].as<std::string>(); |
| 176 | HostStatRec h(std::move(status)); |
| 177 | loadRecord(hostName, h); |
| 178 | } |
| 179 | } catch (std::exception const &ex) { |
| 180 | Warning("Error loading and decoding %s : %s", fileStore.c_str(), ex.what()); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | // loads in host status record. |
| 186 | void |