1
0
mirror of https://github.com/systemd/systemd synced 2026-04-23 23:44:50 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Luca Boccassi
6b72105a78 portable: clarify error when detach fails to match to existing unit
Clarify that it's looking at attached units, not at units inside the referenced
image. Also take into account extensions.
2022-03-26 11:20:39 +00:00
Zbigniew Jędrzejewski-Szmek
d6297626dd NEWS: tweaks 2022-03-25 16:32:16 +01:00
2 changed files with 15 additions and 5 deletions

6
NEWS
View File

@ -192,7 +192,7 @@ CHANGES WITH 251 in spe:
hostnamed.
* hostnamed's D-Bus interface gained a new method GetHardwareSerial()
for reading the hardware serial, as reportd by DMI.
for reading the hardware serial number, as reportd by DMI.
* Two new hwdb files have been added. One lists "handhelds" (PDAs,
calculators, etc.), the other AV production devices (DJ tables,
@ -273,7 +273,7 @@ CHANGES WITH 251 in spe:
the option is still understood to maximize compatibility.
* 'bootctl list' gained support for a new --json= switch to output boot
menu entries in a simply JSON format.
menu entries in JSON format.
* Services with Restart=always and a failing ExecCondition= will no
longer be restarted, to bring ExecCondition= behaviour in line with
@ -284,7 +284,7 @@ CHANGES WITH 251 in spe:
* A new D-Bus property ControlGroupId is now exposed on service units,
that encapsulates the service's numeric cgroup ID that newer kernels
maintain for each cgroup.
assign to each cgroup.
* systemd-networkd gained a new [Bridge] Isolated=true|false setting
that configures the eponymous kernel attribute on the bridge.

View File

@ -1520,6 +1520,7 @@ int portable_detach(
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_set_free_ Set *unit_files = NULL, *markers = NULL;
_cleanup_free_ char *extensions = NULL;
_cleanup_closedir_ DIR *d = NULL;
const char *where, *item;
int ret = 0;
@ -1674,8 +1675,17 @@ int portable_detach(
return ret;
not_found:
log_debug("No unit files associated with '%s' found. Image not attached?", name_or_path);
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "No unit files associated with '%s' found. Image not attached?", name_or_path);
extensions = strv_join(extension_image_paths, ", ");
if (!extensions)
return -ENOMEM;
r = sd_bus_error_setf(error,
BUS_ERROR_NO_SUCH_UNIT,
"No unit files associated with '%s%s%s' found attached to the system. Image not attached?",
name_or_path,
isempty(extensions) ? "" : "' or any of its extensions '",
isempty(extensions) ? "" : extensions);
return log_debug_errno(r, "%s", error->message);
}
static int portable_get_state_internal(