| 248 | */ |
| 249 | |
| 250 | static xmlNode * |
| 251 | retrieveCib(const char *filename, const char *sigfile, gboolean archive_invalid) |
| 252 | { |
| 253 | struct stat buf; |
| 254 | xmlNode *root = NULL; |
| 255 | |
| 256 | crm_info("Reading cluster configuration from: %s (digest: %s)", filename, sigfile); |
| 257 | |
| 258 | if (stat(filename, &buf) != 0) { |
| 259 | crm_warn("Cluster configuration not found: %s", filename); |
| 260 | return NULL; |
| 261 | } |
| 262 | |
| 263 | root = filename2xml(filename); |
| 264 | if (root == NULL) { |
| 265 | crm_err("%s exists but does NOT contain valid XML. ", filename); |
| 266 | crm_warn("Continuing but %s will NOT used.", filename); |
| 267 | |
| 268 | } else if (validate_cib_digest(root, sigfile) == FALSE) { |
| 269 | crm_err("Checksum of %s failed! Configuration contents ignored!", filename); |
| 270 | crm_err("Usually this is caused by manual changes, " |
| 271 | "please refer to http://clusterlabs.org/wiki/FAQ#cib_changes_detected"); |
| 272 | crm_warn("Continuing but %s will NOT used.", filename); |
| 273 | free_xml(root); |
| 274 | root = NULL; |
| 275 | |
| 276 | if (archive_invalid) { |
| 277 | /* Archive the original files so the contents are not lost */ |
| 278 | cib_rename(filename, NULL); |
| 279 | cib_rename(sigfile, NULL); |
| 280 | } |
| 281 | } |
| 282 | return root; |
| 283 | } |
| 284 | |
| 285 | xmlNode * |
| 286 | readCibXmlFile(const char *dir, const char *file, gboolean discard_status) |
no test coverage detected