Skip to content

Commit

Permalink
Merge pull request #749 from imobachgs/better-product-change
Browse files Browse the repository at this point in the history
Better product change
  • Loading branch information
imobachgs authored Sep 12, 2023
2 parents b96c921 + f24fb8d commit 9c310af
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
7 changes: 5 additions & 2 deletions service/lib/agama/dbus/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,12 @@ def register_callbacks
end

backend.software.on_product_selected do |_product|
safe_run do
busy_while { backend.config_phase }
if service_status.busy?
logger.warn "Could not process the product change because the service is busy"
next
end

busy_while { backend.config_phase }
end
end
end
Expand Down
8 changes: 7 additions & 1 deletion service/lib/agama/dbus/software/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ def initialize(backend, logger)
dbus_reader :selected_base_product, "s"

dbus_method :SelectProduct, "in ProductID:s" do |product_id|
logger.info "SelectProduct #{product_id}"
old_product_id = backend.product

if old_product_id == product_id
logger.info "Do not changing the product as it is still the same (#{product_id})"
return
end

logger.info "Selecting product #{product_id}"
select_product(product_id)
dbus_properties_changed(SOFTWARE_INTERFACE, { "SelectedBaseProduct" => product_id }, [])
update_validation # as different product means different software selection
Expand Down
8 changes: 8 additions & 0 deletions service/package/rubygem-agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Sep 12 12:27:33 UTC 2023 - Imobach Gonzalez Sosa <[email protected]>

- Do not crash when it is not possible to handle a product change
in the manager service (related to bsc#1215197).
- When selecting the product, do not perform any change if the
product is still the same.

-------------------------------------------------------------------
Mon Sep 11 11:28:05 UTC 2023 - Imobach Gonzalez Sosa <[email protected]>

Expand Down

0 comments on commit 9c310af

Please sign in to comment.