1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

networkctl: log quietly if we fail to get bit rates

If we query older networked, they will be missing. This is not an error.
Also, make the error more informative, because the bus error itself might
be just "Unknown interface or property" which is not enough to understand
what is going on.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-05-31 16:08:31 +02:00
parent 71923237b1
commit 8210a61ad5

View File

@ -222,9 +222,11 @@ static int acquire_link_bitrates(sd_bus *bus, LinkInfo *link) {
"org.freedesktop.network1.Link",
"BitRates");
if (r < 0) {
if (sd_bus_error_has_name(&error, BUS_ERROR_SPEED_METER_INACTIVE))
return 0;
return log_error_errno(r, "%s", bus_error_message(&error, r));
bool quiet = sd_bus_error_has_name(&error, SD_BUS_ERROR_UNKNOWN_PROPERTY) ||
sd_bus_error_has_name(&error, BUS_ERROR_SPEED_METER_INACTIVE);
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING,
r, "Failed to query link bit rates: %s", bus_error_message(&error, r));
}
r = sd_bus_message_enter_container(reply, 'v', "(dd)");