Mailinglist Archive: yast-commit (1771 mails)

< Previous Next >
[yast-commit] <rest-service> network : properly handle "S" runlevel
  • From: Ladislav Slezak <lslezak@xxxxxxxxxx>
  • Date: Mon, 24 Aug 2009 17:18:49 +0200
  • Message-id: <E1MiTqK-0006cN-Bm@xxxxxxxxxxxxxxxx>
ref: refs/heads/network
commit fea89b49c2eef43194cb9f23442fa0c4d6de747c
Author: Ladislav Slezak <lslezak@xxxxxxxxxx>
Date: Mon Aug 24 14:22:21 2009 +0200

properly handle "S" runlevel
---
plugins/services/app/models/service.rb | 2 +-
plugins/services/test/unit/services_test.rb | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/plugins/services/app/models/service.rb
b/plugins/services/app/models/service.rb
index d22321c..7c5d72c 100644
--- a/plugins/services/app/models/service.rb
+++ b/plugins/services/app/models/service.rb
@@ -22,7 +22,7 @@ class Service

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

diff --git a/plugins/services/test/unit/services_test.rb
b/plugins/services/test/unit/services_test.rb
index 0221d31..4df006c 100644
--- a/plugins/services/test/unit/services_test.rb
+++ b/plugins/services/test/unit/services_test.rb
@@ -21,6 +21,12 @@ class ServiceTest < ActiveSupport::TestCase
end
end

+ test "test S runlevel" do
+ Service.stubs(:run_runlevel).returns("N S")
+
+ assert Service.current_runlevel == -1
+ end
+
test "find_all nil parameter" do
Service.stubs(:run_runlevel).returns("N 5")
YastService.stubs(:Call).with('YaPI::SERVICES::Read', {"runlevel" => [
"i", 5 ], "read_status" => [ "b", false]}).returns([])
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages