]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Keep the first FATAL code inside jcr->StatusInfo
authorEric Bollengier <eric@baculasystems.com>
Fri, 12 Aug 2022 08:19:58 +0000 (10:19 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:59 +0000 (13:56 +0200)
The Job status code is good, but users have to dig into the
log output to determine the reason of the failure.

We can keep the first FATAL message code inside jcr->StatusInfo
and store it in the catalog to help users. ([DE0001] kind of code)

bacula/src/jcr.h
bacula/src/lib/message.c

index e12b0884274da4d79fde0d4710d3fd8b2784909c..83d85d31bfa45e2abbc5f519efd3327bab081cb8 100644 (file)
@@ -357,6 +357,7 @@ public:
    char   *job_user;                  /* Specific permission for a job */
    char   *job_group;                 /* Specific permission for a job */
    POOLMEM *StatusErrMsg;             /* Error message displayed in the job report */
+   char StatusInfo[MAX_NAME_LENGTH];  /* Additionnal information about the error status */
    uint32_t getErrors() { return JobErrors + SDErrors; }; /* Get error count */
 
    /* Daemon specific part of JCR */
index f00fff45fad689d8be3afc81b33ef9f19ddbb05f..7223de13226c26597984e4fb3916f56046722a16 100644 (file)
@@ -1673,6 +1673,14 @@ Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...)
 
     dispatch_message(jcr, type, mtime, rbuf);
 
+    if (type == M_FATAL && jcr && jcr->StatusInfo[0] == 0) {
+       char d, t;
+       int code;
+       if (scan_string(rbuf+len, "[%c%c%d] ", &d, &t, &code) == 3) {
+          bsnprintf(jcr->StatusInfo, sizeof(jcr->StatusInfo), "[%c%c%04d]", d, t, code);
+       }
+    }
+
     if (type == M_ABORT){
        char *p = 0;
        printf("Bacula forced SEG FAULT to obtain traceback.\n");