portablectl: fix using --force when no --extension is passed
The 'force' flag applies whether or not extensions are present
This commit is contained in:
@@ -264,7 +264,7 @@ static int get_image_metadata(sd_bus *bus, const char *image, char **matches, sd
|
|||||||
assert(bus);
|
assert(bus);
|
||||||
assert(reply);
|
assert(reply);
|
||||||
|
|
||||||
method = strv_isempty(arg_extension_images) ? "GetImageMetadata" : "GetImageMetadataWithExtensions";
|
method = strv_isempty(arg_extension_images) && !arg_force ? "GetImageMetadata" : "GetImageMetadataWithExtensions";
|
||||||
|
|
||||||
r = bus_message_new_method_call(bus, &m, bus_portable_mgr, method);
|
r = bus_message_new_method_call(bus, &m, bus_portable_mgr, method);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@@ -907,11 +907,11 @@ static int attach_reattach_image(int argc, char *argv[], const char *method) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int attach_image(int argc, char *argv[], void *userdata) {
|
static int attach_image(int argc, char *argv[], void *userdata) {
|
||||||
return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) ? "AttachImage" : "AttachImageWithExtensions");
|
return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) && !arg_force ? "AttachImage" : "AttachImageWithExtensions");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reattach_image(int argc, char *argv[], void *userdata) {
|
static int reattach_image(int argc, char *argv[], void *userdata) {
|
||||||
return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) ? "ReattachImage" : "ReattachImageWithExtensions");
|
return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) && !arg_force ? "ReattachImage" : "ReattachImageWithExtensions");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int detach_image(int argc, char *argv[], void *userdata) {
|
static int detach_image(int argc, char *argv[], void *userdata) {
|
||||||
@@ -934,7 +934,7 @@ static int detach_image(int argc, char *argv[], void *userdata) {
|
|||||||
|
|
||||||
(void) maybe_stop_disable(bus, image, argv);
|
(void) maybe_stop_disable(bus, image, argv);
|
||||||
|
|
||||||
method = strv_isempty(arg_extension_images) ? "DetachImage" : "DetachImageWithExtensions";
|
method = strv_isempty(arg_extension_images) && !arg_force ? "DetachImage" : "DetachImageWithExtensions";
|
||||||
|
|
||||||
r = bus_message_new_method_call(bus, &m, bus_portable_mgr, method);
|
r = bus_message_new_method_call(bus, &m, bus_portable_mgr, method);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user