Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> master : Don't hide SCR D-Bus exceptions
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Sat, 26 Sep 2009 19:47:02 +0200
  • Message-id: <E1MrZcU-0005cs-9V@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 5a0cad369a838d42922ac7671a5b8285c38b13ac
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Sat Sep 26 19:47:02 2009 +0200

Don't hide SCR D-Bus exceptions
---
.../app/controllers/permissions_controller.rb | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/webservice/app/controllers/permissions_controller.rb
b/webservice/app/controllers/permissions_controller.rb
index 63389e8..984870d 100644
--- a/webservice/app/controllers/permissions_controller.rb
+++ b/webservice/app/controllers/permissions_controller.rb
@@ -25,18 +25,12 @@ class PermissionsController < ApplicationController
suse_string = /org\.opensuse\.yast\..*/

# get users or all actions
- begin
- ret = if user_id
- Scr.instance.execute(["polkit-auth", "--user", user_id,
"--explicit"])
- else
- Scr.instance.execute(["polkit-action"])
- end
- rescue Exception => e
- ret = nil
- logger.error "SCR.execute has raised the exception: #{e.inspect}"
- end
+ ret = if user_id
+ Scr.instance.execute(["polkit-auth", "--user", user_id,
"--explicit"])
+ else
+ Scr.instance.execute(["polkit-action"])
+ end

- raise RuntimeError unless ret && ret[:exit] == 0
ret[:stdout].scan(suse_string) do |p|
next unless filter.blank? or p.include?(filter)
yield p
@@ -56,12 +50,12 @@ class PermissionsController < ApplicationController
# get all known permissions into 'perms' hash
each_suse_permissions( nil, filter ) do |p|
perms[p] = false
- end rescue return false
+ end

# now set those 'true' which are granted
each_suse_permissions( user_id, filter ) do |p|
perms[p] = true
- end rescue return false
+ end

# convert the hash to a list of Permission objects
@permissions = []
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages