mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
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.
This commit is contained in:
parent
d6297626dd
commit
6b72105a78
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user