Hello community,
here is the log from the commit of package webyast-services-ws for
openSUSE:Factory
checked in at Tue May 17 12:37:06 CEST 2011.
--------
--- webyast-services-ws/webyast-services-ws.changes 2011-02-09
10:25:33.000000000 +0100
+++
/mounts/work_src_done/STABLE/webyast-services-ws/webyast-services-ws.changes
2011-05-02 14:41:58.000000000 +0200
@@ -1,0 +2,12 @@
+Mon May 2 12:41:48 UTC 2011 - [email protected]
+
+- adapt caching to the new job handling
+- 0.2.9
+
+-------------------------------------------------------------------
+Tue Apr 12 13:27:34 UTC 2011 - [email protected]
+
+- new caching
+- 0.2.8
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-services-ws.spec ++++++
--- /var/tmp/diff_new_pack.h3KdHC/_old 2011-05-17 12:36:44.000000000 +0200
+++ /var/tmp/diff_new_pack.h3KdHC/_new 2011-05-17 12:36:44.000000000 +0200
@@ -22,11 +22,11 @@
Provides: yast2-webservice-services = %{version}
Obsoletes: yast2-webservice-services < %{version}
PreReq: yast2-webservice
-License: GPLv2
+License: GPL v2 only
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.7
+Version: 0.2.9
Release: 1
Summary: WebYaST - system services management service
Source: www.tar.bz2
@@ -52,7 +52,7 @@
#
%package testsuite
-License: GPLv2
+
Group: Productivity/Networking/Web/Utilities
Requires: %{name} = %{version}
Requires: webyast-base-ws-testsuite
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/www/app/models/service.rb
new/www/app/models/service.rb
--- old/www/app/models/service.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/models/service.rb 2011-04-29 18:23:25.000000000 +0200
@@ -56,11 +56,18 @@
# factored out because of testing
def self.run_runlevel
-# `/sbin/runlevel` # RORSCAN_ITL
+# `/sbin/runlevel` # RORSCAN_ITL
end
+
public
+ def self.cache_argument
+ resource = Resource.find("org.opensuse.yast.modules.yapi.services")
+ return resource.cache_arguments if resource &&
!resource.cache_arguments.blank?
+ return nil
+ end
+
# reading configuration file
#
def self.parse_filter(path = nil)
@@ -88,28 +95,29 @@
# each service.
#
# services = Service.find_all
- def self.find_all(params)
- params = {} if params.nil?
+ def self.find_all(params = nil)
+ YastCache.fetch(self,cache_argument) {
+ params = {} if params.nil?
- services = []
- services_map= {} # helper structure
+ services = []
+ services_map= {} # helper structure
- filter = parse_filter
+ filter = parse_filter
- args = {
+ args = {
"read_status" => [ "b", params.has_key?("read_status")],
"shortdescription" => [ "b", true],
"description" => [ "b", true],
"dependencies" => [ "b", true],
"filter" => [ "as", filter ]
- }
+ }
- # read list of all init.d services
- yapi_ret = YastService.Call("YaPI::SERVICES::Read", args)
+ # read list of all init.d services
+ yapi_ret = YastService.Call("YaPI::SERVICES::Read", args)
- if yapi_ret.nil?
- raise ServiceError.new("no-services", "Can't get services list")
- else
+ if yapi_ret.nil?
+ raise ServiceError.new("no-services", "Can't get services list")
+ else
yapi_ret.each do |s|
service = Service.new(s["name"])
service.status = s["status"].to_i if s.has_key?("status")
@@ -121,45 +129,47 @@
Rails.logger.debug "service: #{service.inspect}"
services_map[s["name"]] = service
end
- end
+ end
- # read list of custom (user defined) services
- args["custom"] = [ "b", true]
- args["dependencies"]= [ "b", false]
+ # read list of custom (user defined) services
+ args["custom"] = [ "b", true]
+ args["dependencies"]= [ "b", false]
- yapi_ret = YastService.Call("YaPI::SERVICES::Read", args)
+ yapi_ret = YastService.Call("YaPI::SERVICES::Read", args)
- if yapi_ret.nil?
- raise ServiceError.new("no-custom-services", "Can't get custom services
list")
- else
- yapi_ret.each do |s|
- service = Service.new(s["name"])
- service.status = s["status"].to_i if s.has_key?("status")
- service.description = s["description"] if s.has_key?("description")
- service.summary = s["shortdescription"] if
s.has_key?("shortdescription")
- service.custom = true
- # service.enabled cannot be checked, we do not know how for custom
service
- Rails.logger.debug "service: #{service.inspect}"
- services_map[s["name"]] = service
+ if yapi_ret.nil?
+ raise ServiceError.new("no-custom-services", "Can't get custom
services list")
+ else
+ yapi_ret.each do |s|
+ service = Service.new(s["name"])
+ service.status = s["status"].to_i if s.has_key?("status")
+ service.description = s["description"] if s.has_key?("description")
+ service.summary = s["shortdescription"] if
s.has_key?("shortdescription")
+ service.custom = true
+ # service.enabled cannot be checked, we do not know how for custom
service
+ Rails.logger.debug "service: #{service.inspect}"
+ services_map[s["name"]] = service
end
- end
- if filter.nil? || filter.empty?
- services = services_map.values.sort { |a,b| a.name <=> b.name }
- else
- filter.each do |name|
- if services_map.has_key? name
- s = services_map[name]
- # filter out dependent services, which are not present in filter
- s.required_for_start.reject! { |rs| !filter.include? rs }
- s.required_for_stop.reject! { |rs| !filter.include? rs }
- services << s
- end
- end
- end
- services
+ end
+ if filter.nil? || filter.empty?
+ services = services_map.values.sort { |a,b| a.name <=> b.name }
+ else
+ filter.each do |name|
+ if services_map.has_key? name
+ s = services_map[name]
+ # filter out dependent services, which are not present in filter
+ s.required_for_start.reject! { |rs| !filter.include? rs }
+ s.required_for_stop.reject! { |rs| !filter.include? rs }
+ services << s
+ end
+ end
+ end
+ services
+ }
end
- def self.find(id)
+ def self.find(id, params = nil)
+ return find_all(params) if id == :all
# actually we do not need to read the real status now
Service.new(id)
end
@@ -213,6 +223,7 @@
raise e
end
Rails.logger.debug "Command returns: #{ret.inspect}"
+ YastCache.reset(self, Service.cache_argument)
ret.symbolize_keys!
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/www/config/resources/services.yml
new/www/config/resources/services.yml
--- old/www/config/resources/services.yml 2010-08-27 14:58:55.000000000
+0200
+++ new/www/config/resources/services.yml 2011-04-11 12:49:05.000000000
+0200
@@ -1,2 +1,11 @@
interface: org.opensuse.yast.modules.yapi.services
controller: services
+
+#cache:
+# enabled: true/false
+# priority: -100..100
+# reload_after: seconds (0 == do not reload)
+# arguments e.g. "{test => '2'}"
+cache:
+ enabled: true
+ arguments: '{"read_status"=>"1"}'
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]