Mailinglist Archive: yast-commit (477 mails)

< Previous Next >
[yast-commit] rest-service : branch, master, updated.
  • From: git version control <git@xxxxxxxxxxxxxxxx>
  • Date: Tue, 23 Jun 2009 15:05:13 +0200
  • Message-id: <E1MJ5gX-0007hZ-8a@xxxxxxxxxxxxxxxx>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "YaST web service".

The branch, master has been updated
via b867ec75ad3ade2736871b3917085dc3835a4dee (commit)
from b35fde64c64eec3106e2883ad078e79ee46c3f56 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b867ec75ad3ade2736871b3917085dc3835a4dee
Author: Martin Vidner <mvidner@xxxxxxx>
Date: Tue Jun 23 15:04:10 2009 +0200

Redirect the other way around

so that ActiveResource in webclient gets 200 instead of 302.

-----------------------------------------------------------------------

Summary of changes and diff:
.../app/controllers/commands_controller.rb | 14 +----------
.../app/controllers/services_controller.rb | 13 +++++++++-
.../test/functional/commands_controller_test.rb | 26 ++++++++++----------
.../test/functional/services_controller_test.rb | 2 +-
4 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/plugins/services/app/controllers/commands_controller.rb
b/plugins/services/app/controllers/commands_controller.rb
index dac4434..32e54ff 100644
--- a/plugins/services/app/controllers/commands_controller.rb
+++ b/plugins/services/app/controllers/commands_controller.rb
@@ -7,19 +7,7 @@ class CommandsController < ApplicationController
before_filter :login_required

def index
- unless permission_check( "org.opensuse.yast.system.services.read")
- render ErrorResult.error(403, 1, "no permission") and return
- end
- id = params[:service_id]
-
- begin
- @service = Lsbservice.new id
- rescue Exception => e # Don't fail on non-existing service. Should be more
specific.
- logger.debug e
- render ErrorResult.error(404, 106, "no such service") and return
- end
- logger.debug "show@service #{@service.inspect}"
- render :show
+ redirect_to service_path(params[:service_id])
end

def update
diff --git a/plugins/services/app/controllers/services_controller.rb
b/plugins/services/app/controllers/services_controller.rb
index fe3fc3a..dceed81 100644
--- a/plugins/services/app/controllers/services_controller.rb
+++ b/plugins/services/app/controllers/services_controller.rb
@@ -13,6 +13,17 @@ class ServicesController < ApplicationController

# show the svc including the commands
def show
- redirect_to service_commands_path(params[:id])
+ unless permission_check( "org.opensuse.yast.system.services.read")
+ render ErrorResult.error(403, 1, "no permission") and return
+ end
+ id = params[:id]
+
+ begin
+ @service = Lsbservice.new id
+ rescue Exception => e # Don't fail on non-existing service. Should be more
specific.
+ logger.debug e
+ render ErrorResult.error(404, 106, "no such service") and return
+ end
+ logger.debug "show@service #{@service.inspect}"
end
end
diff --git a/plugins/services/test/functional/commands_controller_test.rb
b/plugins/services/test/functional/commands_controller_test.rb
index 4702d8c..1a0a4a3 100644
--- a/plugins/services/test/functional/commands_controller_test.rb
+++ b/plugins/services/test/functional/commands_controller_test.rb
@@ -32,22 +32,22 @@ class CommandsControllerTest < ActionController::TestCase

test "access index" do
get :index , :service_id=>"ntp"
- assert_response :success
+ assert_response :redirect
end

- test "access index xml" do
- mime = Mime::XML
- @request.accept = mime.to_s
- get :index, :format => :xml, :service_id=>"ntp"
- assert_equal mime.to_s, @response.content_type
- end
+# test "access index xml" do
+# mime = Mime::XML
+# @request.accept = mime.to_s
+# get :index, :format => :xml, :service_id=>"ntp"
+# assert_equal mime.to_s, @response.content_type
+# end

- test "access index json" do
- mime = Mime::JSON
- @request.accept = mime.to_s
- get :index, :format => :json, :service_id=>"ntp"
- assert_equal mime.to_s, @response.content_type
- end
+# test "access index json" do
+# mime = Mime::JSON
+# @request.accept = mime.to_s
+# get :index, :format => :json, :service_id=>"ntp"
+# assert_equal mime.to_s, @response.content_type
+# end

test "execute service" do
Scr.any_instance.stubs(:execute).with(['/etc/init.d/ntp',
'status']).returns({:exit=>0, :stdout=>"", :stderr=>""})
diff --git a/plugins/services/test/functional/services_controller_test.rb
b/plugins/services/test/functional/services_controller_test.rb
index 839d6e6..dcec53f 100644
--- a/plugins/services/test/functional/services_controller_test.rb
+++ b/plugins/services/test/functional/services_controller_test.rb
@@ -35,7 +35,7 @@ class ServicesControllerTest < ActionController::TestCase

test "access show" do
get :show, :id =>"cron"
- assert_response :redirect
+ assert_response :success
end

end


hooks/post-receive
--
YaST web service
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >