From: Eric Bollengier Date: Mon, 7 Feb 2022 09:50:11 +0000 (+0100) Subject: Rename runscript runswhen from JobEnd to AtJobCompletion X-Git-Tag: Beta-15.0.0~652 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=292cb958478b63b6e2cb03cca9d6ce5ae868e102;p=thirdparty%2Fbacula.git Rename runscript runswhen from JobEnd to AtJobCompletion --- diff --git a/bacula/src/dird/admin.c b/bacula/src/dird/admin.c index 708fda262..9a853f53f 100644 --- a/bacula/src/dird/admin.c +++ b/bacula/src/dird/admin.c @@ -80,7 +80,7 @@ void admin_cleanup(JCR *jcr, int TermCode) /* Job needs to be marked as terminated before running the after runscript */ jcr->setJobStatus(TermCode); - run_scripts(jcr, jcr->job->RunScripts, "EndJob"); + run_scripts(jcr, jcr->job->RunScripts, "AtJobCompletion"); /* Runscript could have changed JobStatus, * now check if it should be changed in the report or not */ diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 1f232430b..dc82c8847 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -994,7 +994,7 @@ void backup_cleanup(JCR *jcr, int TermCode) /* Job needs to be marked as terminated before running the after runscript */ jcr->setJobStatus(TermCode); - run_scripts(jcr, jcr->job->RunScripts, "EndJob"); + run_scripts(jcr, jcr->job->RunScripts, "AtJobCompletion"); /* Runscript could have changed JobStatus, * now check if it should be changed in the report or not */ diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 783a035ac..39d093195 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -2481,12 +2481,12 @@ static void store_runscript_when(LEX *lc, RES_ITEM *item, int index, int pass) *(uint32_t *)(item->value) = SCRIPT_AfterVSS; } else if (strcasecmp(lc->str, "aftersnapshot") == 0) { *(uint32_t *)(item->value) = SCRIPT_AfterVSS; - } else if (strcasecmp(lc->str, "endjob") == 0) { - *(uint32_t *)(item->value) = SCRIPT_EndJob; + } else if (strcasecmp(lc->str, "atjobcompletion") == 0) { + *(uint32_t *)(item->value) = SCRIPT_AtJobCompletion; } else if (strcasecmp(lc->str, "always") == 0) { *(uint32_t *)(item->value) = SCRIPT_Any; } else { - scan_err2(lc, _("Expect %s, got: %s"), "Before, EndJob, After, AfterVSS or Always", lc->str); + scan_err2(lc, _("Expect %s, got: %s"), "Before, AtJobCompletion, After, AfterVSS or Always", lc->str); } scan_to_eol(lc); } diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 64738597e..db07ae9f6 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -832,8 +832,8 @@ int send_runscripts_commands(JCR *jcr) result = send_runscript_with_old_proto(jcr, cmd->when, msg); } else { - /* On the FileDaemon, EndJob is a synonym of After */ - cmd->when = (cmd->when == SCRIPT_EndJob) ? SCRIPT_After : cmd->when; + /* On the FileDaemon, AtJobCompletion is a synonym of After */ + cmd->when = (cmd->when == SCRIPT_AtJobCompletion) ? SCRIPT_After : cmd->when; fd->fsend(runscript, cmd->on_success, cmd->on_failure, cmd->fail_on_error, diff --git a/bacula/src/dird/mac.c b/bacula/src/dird/mac.c index aead3e568..fc588b8e1 100644 --- a/bacula/src/dird/mac.c +++ b/bacula/src/dird/mac.c @@ -855,7 +855,7 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) db_sql_query(wjcr->db, query.c_str(), NULL, NULL); } } - run_scripts(jcr, jcr->job->RunScripts, "EndJob"); + run_scripts(jcr, jcr->job->RunScripts, "AtJobCompletion"); /* Runscript could have changed JobStatus, * now check if it should be changed in the report or not */ diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index 911c7523f..e82e3c479 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -661,7 +661,7 @@ void restore_cleanup(JCR *jcr, int TermCode) /* Job needs to be marked as terminated before running the after runscript */ jcr->setJobStatus(TermCode); - run_scripts(jcr, jcr->job->RunScripts, "EndJob"); + run_scripts(jcr, jcr->job->RunScripts, "AtJobCompletion"); /* Runscript could have changed JobStatus, * now check if it should be changed in the report or not */ diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 465392084..aead6f7de 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -405,7 +405,7 @@ void vbackup_cleanup(JCR *jcr, int TermCode) /* Job needs to be marked as terminated before running the after runscript */ jcr->setJobStatus(TermCode); - run_scripts(jcr, jcr->job->RunScripts, "EndJob"); + run_scripts(jcr, jcr->job->RunScripts, "AtJobCompletion"); /* Runscript could have changed JobStatus, * now check if it should be changed in the report or not */ diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 87b081f12..87079d316 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -472,7 +472,7 @@ void verify_cleanup(JCR *jcr, int TermCode) /* Job needs to be marked as terminated before running the after runscript */ jcr->setJobStatus(TermCode); - run_scripts(jcr, jcr->job->RunScripts, "EndJob"); + run_scripts(jcr, jcr->job->RunScripts, "AtJobCompletion"); /* Runscript could have changed JobStatus, * now check if it should be changed in the report or not */ diff --git a/bacula/src/lib/runscript.c b/bacula/src/lib/runscript.c index 7223d0988..4e8d1ae1f 100644 --- a/bacula/src/lib/runscript.c +++ b/bacula/src/lib/runscript.c @@ -107,8 +107,8 @@ int run_scripts(JCR *jcr, alist *runscripts, const char *label) when = SCRIPT_Before; } else if (bstrcmp(label, NT_("ClientAfterVSS"))) { when = SCRIPT_AfterVSS; - } else if (bstrcmp(label, NT_("EndJob"))) { - when = SCRIPT_EndJob; + } else if (bstrcmp(label, NT_("AtJobCompletion"))) { + when = SCRIPT_AtJobCompletion; } else { when = SCRIPT_After; } @@ -152,15 +152,15 @@ int run_scripts(JCR *jcr, alist *runscripts, const char *label) } } - if ((script->when & SCRIPT_EndJob) && (when & SCRIPT_EndJob)) { - Dmsg1(0, "EndJob jobstatus=%c\n", jcr->JobStatus); + if ((script->when & SCRIPT_AtJobCompletion) && (when & SCRIPT_AtJobCompletion)) { + Dmsg1(0, "AtJobCompletion jobstatus=%c\n", jcr->JobStatus); if ((script->on_success && (jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings)) || (script->on_failure && (job_canceled(jcr) || jcr->JobStatus == JS_Differences)) ) { - Dmsg4(200, "runscript: Run it because SCRIPT_EndJob (%s,%i,%i,%c)\n", + Dmsg4(200, "runscript: Run it because SCRIPT_AtJobCompletion (%s,%i,%i,%c)\n", script->command, script->on_success, script->on_failure, jcr->JobStatus ); /* Set job task code */ diff --git a/bacula/src/lib/runscript.h b/bacula/src/lib/runscript.h index 8ce8307c7..a33154e9b 100644 --- a/bacula/src/lib/runscript.h +++ b/bacula/src/lib/runscript.h @@ -49,7 +49,7 @@ enum { SCRIPT_After = (1<<0), /* AfterJob */ SCRIPT_Before = (1<<1), /* BeforeJob */ SCRIPT_AfterVSS = (1<<2), /* BeforeJob and After VSS */ - SCRIPT_EndJob = (1<<3), /* Before AfterJob on the Director, take status in account */ + SCRIPT_AtJobCompletion = (1<<3), /* Before AfterJob on the Director, take status in account */ SCRIPT_Any = SCRIPT_Before | SCRIPT_After };