manager: also turn on output on unit failure
This commit is contained in:
parent
d450b6f2a9
commit
cb8ccb2271
|
@ -632,15 +632,18 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
|
|||
break;
|
||||
|
||||
case JOB_FAILED:
|
||||
manager_flip_auto_status(u->manager, true);
|
||||
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format);
|
||||
manager_status_printf(u->manager, false, NULL, "See 'systemctl status %s' for details.", u->id);
|
||||
break;
|
||||
|
||||
case JOB_DEPENDENCY:
|
||||
manager_flip_auto_status(u->manager, true);
|
||||
unit_status_printf(u, ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF, format);
|
||||
break;
|
||||
|
||||
case JOB_TIMEOUT:
|
||||
manager_flip_auto_status(u->manager, true);
|
||||
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format);
|
||||
break;
|
||||
|
||||
|
@ -657,6 +660,7 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
|
|||
switch (result) {
|
||||
|
||||
case JOB_TIMEOUT:
|
||||
manager_flip_auto_status(u->manager, true);
|
||||
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON " TIME " ANSI_HIGHLIGHT_OFF, format);
|
||||
break;
|
||||
|
||||
|
|
|
@ -136,6 +136,16 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
|
|||
}
|
||||
}
|
||||
|
||||
void manager_flip_auto_status(Manager *m, bool enable) {
|
||||
if (enable) {
|
||||
if (m->show_status == SHOW_STATUS_AUTO)
|
||||
manager_set_show_status(m, SHOW_STATUS_TEMPORARY);
|
||||
} else {
|
||||
if (m->show_status == SHOW_STATUS_TEMPORARY)
|
||||
manager_set_show_status(m, SHOW_STATUS_AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
static void manager_print_jobs_in_progress(Manager *m) {
|
||||
_cleanup_free_ char *job_of_n = NULL;
|
||||
Iterator i;
|
||||
|
@ -148,8 +158,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
|
|||
|
||||
assert(m);
|
||||
|
||||
if (m->show_status == SHOW_STATUS_AUTO)
|
||||
manager_set_show_status(m, SHOW_STATUS_TEMPORARY);
|
||||
manager_flip_auto_status(m, true);
|
||||
|
||||
print_nr = (m->jobs_in_progress_iteration / JOBS_IN_PROGRESS_PERIOD_DIVISOR) % m->n_running_jobs;
|
||||
|
||||
|
@ -2459,8 +2468,7 @@ void manager_check_finished(Manager *m) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (m->show_status == SHOW_STATUS_TEMPORARY)
|
||||
manager_set_show_status(m, SHOW_STATUS_AUTO);
|
||||
manager_flip_auto_status(m, false);
|
||||
|
||||
/* Notify Type=idle units that we are done now */
|
||||
m->idle_pipe_event_source = sd_event_source_unref(m->idle_pipe_event_source);
|
||||
|
|
|
@ -299,5 +299,6 @@ void manager_recheck_journal(Manager *m);
|
|||
|
||||
void manager_set_show_status(Manager *m, ShowStatus mode);
|
||||
void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_(4,5);
|
||||
void manager_flip_auto_status(Manager *m, bool enable);
|
||||
|
||||
Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path);
|
||||
|
|
Loading…
Reference in New Issue