mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
job: change result field for log message about job result RESULT= → JOB_RESULT=
So, currently, some of the structured log messages we generated based on jobs carry the result in RESULT=, and others in JOB_RESULT=. Let's streamline this, as stick to JOB_RESULT= in one place. This is kind of an API break, but given that currently most software has to check both fields anyway, I think we can get away with it. Why unify on JOB_RESULT= rather than RESULT=? Well, we manage different types of result codes in systemd. Most importanlty besides job results there are also service results, and we should be explicit in what we mean here.
This commit is contained in:
parent
dba1bd4396
commit
646cc98dc8
@ -806,7 +806,8 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
|
|||||||
default:
|
default:
|
||||||
log_struct(job_result_log_level[result],
|
log_struct(job_result_log_level[result],
|
||||||
LOG_MESSAGE("%s", buf),
|
LOG_MESSAGE("%s", buf),
|
||||||
"RESULT=%s", job_result_to_string(result),
|
"JOB_TYPE=%s", job_type_to_string(t),
|
||||||
|
"JOB_RESULT=%s", job_result_to_string(result),
|
||||||
LOG_UNIT_ID(u),
|
LOG_UNIT_ID(u),
|
||||||
LOG_UNIT_INVOCATION_ID(u),
|
LOG_UNIT_INVOCATION_ID(u),
|
||||||
NULL);
|
NULL);
|
||||||
@ -815,7 +816,8 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
|
|||||||
|
|
||||||
log_struct(job_result_log_level[result],
|
log_struct(job_result_log_level[result],
|
||||||
LOG_MESSAGE("%s", buf),
|
LOG_MESSAGE("%s", buf),
|
||||||
"RESULT=%s", job_result_to_string(result),
|
"JOB_TYPE=%s", job_type_to_string(t),
|
||||||
|
"JOB_RESULT=%s", job_result_to_string(result),
|
||||||
LOG_UNIT_ID(u),
|
LOG_UNIT_ID(u),
|
||||||
LOG_UNIT_INVOCATION_ID(u),
|
LOG_UNIT_INVOCATION_ID(u),
|
||||||
mid,
|
mid,
|
||||||
@ -823,6 +825,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void job_emit_status_message(Unit *u, JobType t, JobResult result) {
|
static void job_emit_status_message(Unit *u, JobType t, JobResult result) {
|
||||||
|
assert(u);
|
||||||
|
|
||||||
/* No message if the job did not actually do anything due to failed condition. */
|
/* No message if the job did not actually do anything due to failed condition. */
|
||||||
if (t == JOB_START && result == JOB_DONE && !u->condition_result)
|
if (t == JOB_START && result == JOB_DONE && !u->condition_result)
|
||||||
@ -905,7 +908,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
|
|||||||
* the unit itself. We don't treat JOB_CANCELED as failure in
|
* the unit itself. We don't treat JOB_CANCELED as failure in
|
||||||
* this context. And JOB_FAILURE is already handled by the
|
* this context. And JOB_FAILURE is already handled by the
|
||||||
* unit itself. */
|
* unit itself. */
|
||||||
if (result == JOB_TIMEOUT || result == JOB_DEPENDENCY) {
|
if (IN_SET(result, JOB_TIMEOUT, JOB_DEPENDENCY)) {
|
||||||
log_struct(LOG_NOTICE,
|
log_struct(LOG_NOTICE,
|
||||||
"JOB_TYPE=%s", job_type_to_string(t),
|
"JOB_TYPE=%s", job_type_to_string(t),
|
||||||
"JOB_RESULT=%s", job_result_to_string(result),
|
"JOB_RESULT=%s", job_result_to_string(result),
|
||||||
|
Loading…
Reference in New Issue
Block a user