ref: refs/heads/master
commit b170d3c150766d2ccf0173ec8fbdad6c5065788b
Author: Jiri Suchomel
Date: Fri Aug 14 10:02:47 2009 +0200
use put method and show its result
---
.../app/controllers/services_controller.rb | 32 ++++++++------------
1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/plugins/services/app/controllers/services_controller.rb b/plugins/services/app/controllers/services_controller.rb
index 57ebe58..9d86f9d 100644
--- a/plugins/services/app/controllers/services_controller.rb
+++ b/plugins/services/app/controllers/services_controller.rb
@@ -43,26 +43,20 @@ class ServicesController < ApplicationController
return unless client_permissions
@service = @client.find(params[:service_id])
- @service.execute = params[:id]
- @service.save
+ response = @client.put(params[:service_id], :execute => params[:id])
-# @service.id = @service.link
-# command_id = "commands/" + params[:id]
-# logger.debug "calling #{command_id} with service #{@service.inspect}"
-# response = @service.put(command_id)
-#
-# # we get a hash with exit, stderr, stdout
-# ret = Hash.from_xml(response.body)
-# ret = ret["hash"]
-# logger.debug "returns #{ret.inspect}"
-#
-# @result_string = ""
-# @result_string << ret["stdout"] if ret["stdout"]
-# @result_string << ret["stderr"] if ret["stderr"]
-# @error_string = ret["exit"].to_s # TODO translate exit codes (use YaST?)
-# if ret["exit"] == 0
-# @error_string = _("success")
-# end
+ # we get a hash with exit, stderr, stdout
+ ret = Hash.from_xml(response.body)
+ ret = ret["hash"]
+ logger.debug "returns #{ret.inspect}"
+
+ @result_string = ""
+ @result_string << ret["stdout"] if ret["stdout"]
+ @result_string << ret["stderr"] if ret["stderr"]
+ @error_string = ret["exit"].to_s
+ if ret["exit"] == 0
+ @error_string = _("success")
+ end
render(:partial =>'result')
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org