1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

transaction.c: do not point users to logs when unit not found

The logs are unlikely to contain any useful information in this case.

Also, change "walked on cycle path" to "found dependency on", which
is less technical and indicates the direction. With the old message,
I was never sure if prior units depended on later ones, or vice versa.

https://bugzilla.redhat.com/show_bug.cgi?id=996133
https://bugzilla.redhat.com/show_bug.cgi?id=997082
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-09-15 12:15:38 -04:00
parent c32fc72f37
commit 1244d8d640

View File

@ -344,7 +344,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
assert(!j->transaction_prev);
/* Does a recursive sweep through the ordering graph, looking
* for a cycle. If we find cycle we try to break it. */
* for a cycle. If we find a cycle we try to break it. */
/* Have we seen this before? */
if (j->generation == generation) {
@ -371,7 +371,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
/* logging for j not k here here to provide consistent narrative */
log_info_unit(j->unit->id,
"Walked on cycle path to %s/%s",
"Found dependency on %s/%s",
k->unit->id, job_type_to_string(k->type));
if (!delete &&
@ -860,7 +860,7 @@ int transaction_add_job_and_dependencies(
return -EINVAL;
}
if (type != JOB_STOP && (unit->load_state == UNIT_ERROR || unit->load_state == UNIT_NOT_FOUND)) {
if (type != JOB_STOP && unit->load_state == UNIT_ERROR) {
dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
"Unit %s failed to load: %s. "
"See system logs and 'systemctl status %s' for details.",
@ -870,6 +870,14 @@ int transaction_add_job_and_dependencies(
return -EINVAL;
}
if (type != JOB_STOP && unit->load_state == UNIT_NOT_FOUND) {
dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
"Unit %s failed to load: %s.",
unit->id,
strerror(-unit->load_error));
return -EINVAL;
}
if (type != JOB_STOP && unit->load_state == UNIT_MASKED) {
dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->id);
return -EADDRNOTAVAIL;