[yast-commit] <rest-service> master : handle PackageKit errors (bnc #559233)

ref: refs/heads/master commit d50ad4b891552d7f205325e408fca63ad53d5a89 Author: Stefan Schubert <schubi@suse.de> Date: Fri Dec 18 13:10:02 2009 +0100 handle PackageKit errors (bnc #559233) --- plugins/patches/app/models/resolvable.rb | 30 +++++++++++++++++++- .../package/yast2-webservice-patches.changes | 5 +++ 2 files changed, 34 insertions(+), 1 deletions(-) diff --git a/plugins/patches/app/models/resolvable.rb b/plugins/patches/app/models/resolvable.rb index 09b1795..7b9acc3 100644 --- a/plugins/patches/app/models/resolvable.rb +++ b/plugins/patches/app/models/resolvable.rb @@ -7,6 +7,23 @@ require 'thread' require 'exceptions' +class PackageKitError < BackendException + def initialize(description) + @description = description + super("PackageKit error") + end + + def to_xml + xml = Builder::XmlMarkup.new({}) + xml.instruct! + + xml.error do + xml.type "PACKAGEKIT_ERROR" + xml.description @description + end + end +end + class Resolvable attr_accessor :resolvable_id, @@ -124,7 +141,18 @@ public proxy = transaction_iface.object proxy.on_signal(signal.to_s, &block) - proxy.on_signal("Error") {|u1,u2| dbusloop.quit } + proxy.on_signal("ErrorCode") {|u1,u2| + error_string = "#{u1}: #{u2}" + Rails.logger.error error_string + dbusloop.quit + raise PackageKitError.new(error_string) + } + proxy.on_signal("RepoSignatureRequired") {|u1,u2,u3,u4,u5,u6,u7,u8| + error_string = "Repository #{u2} needs to be signed" + Rails.logger.error error_string + dbusloop.quit + raise PackageKitError.new(error_string) + } proxy.on_signal("Finished") {|u1,u2| dbusloop.quit } # Do the call only when all signal handlers are in place, # otherwise Finished can arrive early and dbusloop will never diff --git a/plugins/patches/package/yast2-webservice-patches.changes b/plugins/patches/package/yast2-webservice-patches.changes index c85bfc4..458d60e 100644 --- a/plugins/patches/package/yast2-webservice-patches.changes +++ b/plugins/patches/package/yast2-webservice-patches.changes @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Fri Dec 18 13:09:28 CET 2009 - schubi@suse.de + +- handle PackageKit errors (bnc #559233) + +------------------------------------------------------------------- Tue Dec 8 18:24:24 CET 2009 - mvidner@suse.cz - Fixed a hang when PackageKit responded too fast (bnc#561578). -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Stefan Schubert