diff --git a/src/sacctmgr/federation_functions.c b/src/sacctmgr/federation_functions.c index e458dbe53636661ce2ed2cb9c1724535fe8590ab..40c2ad3a2801e44bd7e2b3e65f9154431e229723 100644 --- a/src/sacctmgr/federation_functions.c +++ b/src/sacctmgr/federation_functions.c @@ -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: