Skip to content

Commit

Permalink
Update calls to yast2 systemd services (#20)
Browse files Browse the repository at this point in the history
* Update calls to Yast2::Systemd::Service

* Update yast2 dependency

* Update version and changelog
  • Loading branch information
dgdavid committed Aug 23, 2018
1 parent a8264dc commit a421f2f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions package/yast2-sysconfig.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Aug 23 14:34:31 UTC 2018 - dgonzalez@suse.com

- Update calls to Yast2 systemd classes (related to #319428)
- 4.1.0

-------------------------------------------------------------------
Wed Aug 22 14:50:06 CEST 2018 - schubi@suse.de

Expand Down
5 changes: 3 additions & 2 deletions package/yast2-sysconfig.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-sysconfig
Version: 4.0.1
Version: 4.1.0
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand All @@ -30,7 +30,8 @@ BuildRequires: yast2-devtools >= 3.1.10
# path_matching (RSpec argument matcher)
BuildRequires: yast2-ruby-bindings >= 3.1.31
Requires: perl
Requires: yast2 >= 2.21.22
# Yast2::Systemd::Service
Requires: yast2 >= 4.1.3

# For tests
BuildRequires: ruby
Expand Down
6 changes: 3 additions & 3 deletions src/modules/Sysconfig.rb
Expand Up @@ -10,6 +10,7 @@
# Representation of the configuration of sysconfig.
# Input and output routines.
require "yast"
require "yast2/systemd/service"

module Yast
class SysconfigClass < Module
Expand All @@ -28,7 +29,6 @@ def main
Yast.import "String"
Yast.import "Service"
Yast.import "Mode"
Yast.import "SystemdService"


@configfiles = [
Expand Down Expand Up @@ -1166,7 +1166,7 @@ def exec_service_action(name, type = :reload)

action = lambda do
log.info "Service #{name} will be restarted (#{type})"
service = SystemdService.find(name)
service = Yast2::Systemd::Service.find(name)
return false unless service
service.send(type)
end
Expand All @@ -1180,7 +1180,7 @@ def exec_service_action(name, type = :reload)
# @param service name
# @return [Boolean] active?
def service_active?(service_name)
service_unit = SystemdService.find(service_name)
service_unit = Yast2::Systemd::Service.find(service_name)

unless service_unit
Report.Error(
Expand Down
6 changes: 3 additions & 3 deletions test/sysconfig_test.rb
@@ -1,9 +1,9 @@
#!/usr/bin/env rspec

require_relative 'test_helper'
require "yast2/systemd/service"

Yast.import "Sysconfig"
Yast.import "SystemdService"

describe Yast::Sysconfig do
subject(:sysconfig) do
Expand Down Expand Up @@ -183,7 +183,7 @@
allow(Yast::SCR).to receive(:Write).with(path_matching(/^\.syseditor/), anything)

service = double("postfix_service")
allow(Yast::SystemdService).to receive(:find).with("postfix").and_return service
allow(Yast2::Systemd::Service).to receive(:find).with("postfix").and_return service
expect(service).to receive(:active?).and_return true
expect(service).to receive(:restart)

Expand All @@ -195,7 +195,7 @@
allow(Yast::SCR).to receive(:Write).with(path_matching(/^\.syseditor/), anything)

service = double("postfix_service")
allow(Yast::SystemdService).to receive(:find).with("postfix").and_return service
allow(Yast2::Systemd::Service).to receive(:find).with("postfix").and_return service
expect(service).to receive(:active?).and_return true
expect(service).to receive(:reload)

Expand Down

0 comments on commit a421f2f

Please sign in to comment.