portablectl: fix detaching when an extension image has been deleted
This commit is contained in:
committed by
Frantisek Sumsal
parent
4e3c9c8c0b
commit
ba8eda568c
@@ -108,7 +108,10 @@ static int attach_extensions_to_message(sd_bus_message *m, const char *method, c
|
||||
STRV_FOREACH(p, extensions) {
|
||||
_cleanup_free_ char *resolved_extension_image = NULL;
|
||||
|
||||
r = determine_image(*p, false, &resolved_extension_image);
|
||||
r = determine_image(
|
||||
*p,
|
||||
startswith_strv(method, STRV_MAKE("Get", "Detach")),
|
||||
&resolved_extension_image);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -186,7 +186,11 @@ status="$(portablectl is-attached --extension /tmp/app10.raw /usr/share/minimal_
|
||||
|
||||
portablectl inspect --force --cat --extension /tmp/app10.raw /usr/share/minimal_0.raw app0 | grep -q -F "Extension Release: /tmp/app10.raw"
|
||||
|
||||
portablectl detach --force --now --runtime --extension /tmp/app10.raw /usr/share/minimal_0.raw app0
|
||||
# Ensure that we can detach even when an image has been deleted already (stop the unit manually as
|
||||
# portablectl won't find it)
|
||||
rm -f /tmp/app10.raw
|
||||
systemctl stop app0.service
|
||||
portablectl detach --force --runtime --extension /tmp/app10.raw /usr/share/minimal_0.raw app0
|
||||
|
||||
# portablectl also accepts confexts
|
||||
portablectl "${ARGS[@]}" attach --now --runtime --extension /usr/share/app0.raw --extension /usr/share/conf0.raw /usr/share/minimal_0.raw app0
|
||||
|
||||
Reference in New Issue
Block a user