From eab62c01ef81adb85dbbb561b3102d1cf960f5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 16 Aug 2022 18:07:30 +0200 Subject: manager: allow assignment of properties on target/swap/device units E.g. Documentation or Markers could apply to any unit type. This already worked partially, because a direct dbus call could be made: After rebuild with the patch, but before the manager has been restarted: $ build/systemctl --user set-property dev-zram0.swap Markers=+needs-restart $ build/systemctl --user show -p Markers dev-zram0.swap Markers=needs-restart I noticed that that the rpm unit restart helper was throwing errors for target units. We should just let the Markers be set for those too, even if it doesn't do anything in the end. This way we don't need to special-case by unit type. --- src/shared/bus-unit-util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/shared/bus-unit-util.c') diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index edc2cfa937..2bf0d855b1 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -2640,12 +2640,10 @@ int bus_append_unit_property_assignment(sd_bus_message *m, UnitType t, const cha case UNIT_TARGET: case UNIT_DEVICE: case UNIT_SWAP: - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Not supported unit type"); + break; default: - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Invalid unit type"); + assert_not_reached(); } r = bus_append_unit_property(m, field, eq); -- cgit v1.2.1