tree-wide: Use "unmet" for condition checks, not "failed"

Often I end up debugging a problem on a system, and I
do e.g. `journalctl --grep=failed|error`.  The use of the term
"failed" for condition checks adds a *lot* of unnecessary noise into
this.

Now, I know this regexp search isn't precise, but it has proven
to be useful to me.

I think "failed" is too strong of a term as a baseline, and also
just stands out to e.g. humans watching their servers boot or
whatever.

The term "met condition" is fairly widely used, e.g.
https://stackoverflow.com/questions/63751794/what-does-the-condition-is-met-exactly-mean-in-programming-languages

Use that instead.
This commit is contained in:
Colin Walters 2022-08-31 16:39:03 -04:00 committed by Yu Watanabe
parent 133ac84e60
commit 413e8650b7
5 changed files with 10 additions and 10 deletions

View file

@ -705,7 +705,7 @@
<para>When used in conjunction with <varname>After=</varname> on the same unit the behaviour of
<varname>BindsTo=</varname> is even stronger. In this case, the unit bound to strictly has to be in active
state for this unit to also be in active state. This not only means a unit bound to another unit that suddenly
enters inactive state, but also one that is bound to another unit that gets skipped due to a failed condition
enters inactive state, but also one that is bound to another unit that gets skipped due to an unmet condition
check (such as <varname>ConditionPathExists=</varname>, <varname>ConditionPathIsSymbolicLink=</varname>, … —
see below) will be stopped, should it be running. Hence, in many cases it is best to combine
<varname>BindsTo=</varname> with <varname>After=</varname>.</para>
@ -1170,7 +1170,7 @@
<para>The <varname>AssertArchitecture=</varname>, <varname>AssertVirtualization=</varname>, … options
are similar to conditions but cause the start job to fail (instead of being skipped). The failed check
is logged. Units with failed conditions are considered to be in a clean state and will be garbage
is logged. Units with unmet conditions are considered to be in a clean state and will be garbage
collected if they are not referenced. This means that when queried, the condition failure may or may
not show up in the state of the unit.</para>

View file

@ -610,7 +610,7 @@ static const char* job_done_message_format(Unit *u, JobType t, JobResult result)
assert(t >= 0);
assert(t < _JOB_TYPE_MAX);
/* Show condition check message if the job did not actually do anything due to failed condition. */
/* Show condition check message if the job did not actually do anything due to unmet condition. */
if (t == JOB_START && result == JOB_DONE && !u->condition_result)
return "Condition check resulted in %s being skipped.";
@ -702,7 +702,7 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult
bool console_only = do_console && log_on_console();
if (t == JOB_START && result == JOB_DONE && !u->condition_result) {
/* No message on the console if the job did not actually do anything due to failed condition. */
/* No message on the console if the job did not actually do anything due to unmet condition. */
if (console_only)
return;
else
@ -716,13 +716,13 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult
c = t == JOB_START && result == JOB_DONE ? unit_find_failed_condition(u) : NULL;
if (c) {
/* Special case units that were skipped because of a failed condition check so that
/* Special case units that were skipped because of a unmet condition check so that
* we can add more information to the message. */
if (c->trigger)
log_unit_struct(
u,
job_done_messages[result].log_level,
LOG_MESSAGE("%s was skipped because all trigger condition checks failed.",
LOG_MESSAGE("%s was skipped because no trigger condition checks were met.",
ident),
"JOB_ID=%" PRIu32, job_id,
"JOB_TYPE=%s", job_type_to_string(t),
@ -733,7 +733,7 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult
log_unit_struct(
u,
job_done_messages[result].log_level,
LOG_MESSAGE("%s was skipped because of a failed condition check (%s=%s%s).",
LOG_MESSAGE("%s was skipped because of an unmet condition check (%s=%s%s).",
ident,
condition_type_to_string(c->type),
c->negate ? "!" : "",

View file

@ -84,7 +84,7 @@ enum JobMode {
};
enum JobResult {
JOB_DONE, /* Job completed successfully (or skipped due to a failed ConditionXYZ=) */
JOB_DONE, /* Job completed successfully (or skipped due to an unmet ConditionXYZ=) */
JOB_CANCELED, /* Job canceled by a conflicting job installation or by explicit cancel request */
JOB_TIMEOUT, /* Job timeout elapsed */
JOB_FAILED, /* Job failed */

View file

@ -369,7 +369,7 @@ static int path_add_extras(Path *p) {
assert(p);
/* To avoid getting pid1 in a busy-loop state (eg: failed condition on associated service),
/* To avoid getting pid1 in a busy-loop state (eg: unmet condition on associated service),
* set a default trigger limit if the user didn't specify any. */
if (p->trigger_limit.interval == USEC_INFINITY)
p->trigger_limit.interval = 2 * USEC_PER_SEC;

View file

@ -1916,7 +1916,7 @@ int unit_start(Unit *u, ActivationDetails *details) {
/* Let's make sure that the deps really are in order before we start this. Normally the job engine
* should have taken care of this already, but let's check this here again. After all, our
* dependencies might not be in effect anymore, due to a reload or due to a failed condition. */
* dependencies might not be in effect anymore, due to a reload or due to an unmet condition. */
if (!unit_verify_deps(u))
return -ENOLINK;