return foreach_assertion_bgpsec(&db->lists, cb, arg);
}
-void
+int
db_slurm_update_time(struct db_slurm *db)
{
- db->loaded_date = time(NULL);
+ int error;
+
+ error = get_current_time(&db->loaded_date);
+ if (error)
+ return error;
+
db->loaded_date_set = true;
+ return 0;
}
static int
void *);
/* Set the last update to current datetime */
-void db_slurm_update_time(struct db_slurm *);
+int db_slurm_update_time(struct db_slurm *);
/* Log the DB in human readable form at INFO level */
void db_slurm_log(struct db_slurm *);
int error;
error = load_slurm_files(params);
- if (error) {
- /* Any error: use last valid SLURM */
- pr_op_info("Error loading SLURM, the validation will still continue.");
- if (*last_slurm != NULL) {
- pr_op_info("A previous valid version of the SLURM exists and will be applied.");
- params->db_slurm = *last_slurm;
- /* Log applied SLURM as info */
- db_slurm_log(params->db_slurm);
- }
- destroy_local_csum_list(csum_list);
- return;
+ if (error)
+ goto use_last_slurm;
+
+ /* Prepare the new SLURM DB */
+ if (params->db_slurm != NULL) {
+ error = db_slurm_update_time(params->db_slurm);
+ if (error)
+ goto use_last_slurm;
+ db_slurm_set_csum_list(params->db_slurm, csum_list);
}
/* Use new SLURM as last valid slurm */
db_slurm_destroy(*last_slurm);
*last_slurm = params->db_slurm;
+
+use_last_slurm:
+ /* Any error: use last valid SLURM */
+ pr_op_info("Error loading SLURM, the validation will still continue.");
if (*last_slurm != NULL) {
- db_slurm_update_time(*last_slurm);
- db_slurm_set_csum_list(*last_slurm, csum_list);
+ pr_op_info("A previous valid version of the SLURM exists and will be applied.");
+ params->db_slurm = *last_slurm;
+ /* Log applied SLURM as info */
+ db_slurm_log(params->db_slurm);
}
+ destroy_local_csum_list(csum_list);
}
static bool