Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <rest-service> dmacvicar_log_viewer : read custom service description, if available
  • From: Jiri Suchomel <jsuchome@xxxxxxx>
  • Date: Tue, 8 Sep 2009 10:23:54 +0200
  • Message-id: <E1MlPsJ-0006BN-3L@xxxxxxxxxxxxxxxx>
ref: refs/heads/dmacvicar_log_viewer
commit 4badc15a4cd08efc6528befd1564634cf9962bcb
Author: Jiri Suchomel <jsuchome@xxxxxxx>
Date: Tue Sep 8 10:23:54 2009 +0200

read custom service description, if available
---
plugins/services/app/models/service.rb | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/plugins/services/app/models/service.rb
b/plugins/services/app/models/service.rb
index 3ab8f27..36a0964 100644
--- a/plugins/services/app/models/service.rb
+++ b/plugins/services/app/models/service.rb
@@ -6,6 +6,7 @@ class Service

attr_accessor :name
attr_accessor :status
+ attr_accessor :description

def initialize(name)
@name = name
@@ -20,12 +21,21 @@ class Service

public

+ # Return current system runlevel,
def self.current_runlevel
rl = run_runlevel.split(" ").last
raise Exception.new('Non-number runlevel') if !/^[0-9]*$/.match rl and rl
!= "S"
rl == "S" ? -1 : rl.to_i
end

+ # Read the list of all services.
+ # If the key "custom" is present in the parameter hash, read the list of
+ # custom services from the file. Otherwise, read LSB services available in
+ # current system runlevel.
+ #
+ # If the key "read_status" is present in the parameter hash, read the status
of
+ # each service.
+ #
# services = Service.find_all
def self.find_all(params)
params = {} if params.nil?
@@ -42,6 +52,9 @@ class Service
ret = Scr.instance.execute([s["status"]])
service.status = ret[:exit]
end
+ if s.has_key?("description")
+ service.description = s["description"]
+ end
Rails.logger.debug "custom service: #{service.inspect}"
services << service
end
@@ -70,12 +83,12 @@ class Service
services
end

- # load the status of the service
def self.find(id)
# actually we do not need to read the real status now
Service.new(id)
end

+ # load the status of the service
def read_status
@status = save('status')[:exit]
end
@@ -118,6 +131,7 @@ class Service

xml.service do
xml.name name
+ xml.description description
xml.status status, {:type => "integer"}
end
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages