Skip to content
Snippets Groups Projects
Commit 25c7c04a authored by Brian Christiansen's avatar Brian Christiansen
Browse files

Do commit check after adding federations

Was modeled after cluster adding where commit the check was being done
before sending the changes to the dbd. But since the dbd isn't making
any additional tables for federations -- like it does for clusters -- it
can send to the dbd first and make sure they worked and then ask to
commit the changes.
parent 1ae87b91
No related branches found
No related tags found
No related merge requests found
......@@ -474,27 +474,23 @@ extern int sacctmgr_add_federation(int argc, char *argv[])
goto end_it;
}
/* Since we are creating tables with add federation that can't be
rolled back. So we ask before hand if they are serious
about it so we can rollback if needed.
*/
if (commit_check("Would you like to commit changes?")) {
notice_thread_init();
rc = acct_storage_g_add_federations(db_conn, my_uid,
federation_list);
notice_thread_fini();
if (rc == SLURM_SUCCESS) {
notice_thread_init();
rc = acct_storage_g_add_federations(db_conn, my_uid,
federation_list);
notice_thread_fini();
if (rc == SLURM_SUCCESS) {
if (commit_check("Would you like to commit changes?")) {
acct_storage_g_commit(db_conn, 1);
} else {
fprintf(stderr, " Problem adding federation(s): %s\n",
slurm_strerror(rc));
/* this isn't really needed, but just to be safe */
printf(" Changes Discarded\n");
acct_storage_g_commit(db_conn, 0);
}
} else {
printf(" Changes Discarded\n");
/* this isn't really needed, but just to be safe */
acct_storage_g_commit(db_conn, 0);
exit_code = 1;
fprintf(stderr, " Problem adding federation(s): %s\n",
slurm_strerror(rc));
rc = SLURM_ERROR;
}
end_it:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment