mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
systemd-analyze: allow --quiet for condition checks
I figure these messages are rather unnecessary, so let the user quiet them with the existing --quiet flag if desired. Makes systemd-analyze condition a little more ergonomic in scripts.
This commit is contained in:
parent
21a2c735e2
commit
f24590df43
@ -123,13 +123,14 @@ static int verify_conditions(char **lines, RuntimeScope scope, const char *unit,
|
||||
}
|
||||
}
|
||||
|
||||
r = condition_test_list(u->asserts, environ, assert_type_to_string, log_helper, u);
|
||||
condition_test_logger_t logger = arg_quiet ? NULL : log_helper;
|
||||
r = condition_test_list(u->asserts, environ, assert_type_to_string, logger, u);
|
||||
if (u->asserts)
|
||||
log_notice("Asserts %s.", r > 0 ? "succeeded" : "failed");
|
||||
log_full(arg_quiet ? LOG_DEBUG : LOG_NOTICE, "Asserts %s.", r > 0 ? "succeeded" : "failed");
|
||||
|
||||
q = condition_test_list(u->conditions, environ, condition_type_to_string, log_helper, u);
|
||||
q = condition_test_list(u->conditions, environ, condition_type_to_string, logger, u);
|
||||
if (u->conditions)
|
||||
log_notice("Conditions %s.", q > 0 ? "succeeded" : "failed");
|
||||
log_full(arg_quiet ? LOG_DEBUG : LOG_NOTICE, "Conditions %s.", q > 0 ? "succeeded" : "failed");
|
||||
|
||||
return r > 0 && q > 0 ? 0 : -EIO;
|
||||
}
|
||||
|
@ -1206,8 +1206,6 @@ bool condition_test_list(
|
||||
|
||||
int triggered = -1;
|
||||
|
||||
assert(!!logger == !!to_string);
|
||||
|
||||
/* If the condition list is empty, then it is true */
|
||||
if (!first)
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user