Hello community,
here is the log from the commit of package yast2-samba-server for
openSUSE:Factory checked in at 2018-09-04 22:49:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-samba-server (Old)
and /work/SRC/openSUSE:Factory/.yast2-samba-server.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-samba-server"
Tue Sep 4 22:49:54 2018 rev:80 rq:630799 version:4.1.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-samba-server/yast2-samba-server.changes
2018-08-04 21:51:03.337013427 +0200
+++
/work/SRC/openSUSE:Factory/.yast2-samba-server.new/yast2-samba-server.changes
2018-09-04 22:49:58.379727247 +0200
@@ -1,0 +2,18 @@
+Mon Aug 20 16:09:08 CEST 2018 - [email protected]
+
+- Switched license in spec file from SPDX2 to SPDX3 format.
+
+-------------------------------------------------------------------
+Mon Aug 13 10:58:01 UTC 2018 - [email protected]
+
+- Use Yast2::ServiceWidget to manage the service status
+ (part of fate#319428)
+- 4.1.0
+
+-------------------------------------------------------------------
+Mon Aug 13 10:39:59 UTC 2018 - [email protected]
+
+- Fix package building with yast2 4.0.84 (bsc#1104644).
+- 4.0.4
+
+-------------------------------------------------------------------
Old:
----
yast2-samba-server-4.0.3.tar.bz2
New:
----
yast2-samba-server-4.1.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-samba-server.spec ++++++
--- /var/tmp/diff_new_pack.IHFImo/_old 2018-09-04 22:49:58.811728731 +0200
+++ /var/tmp/diff_new_pack.IHFImo/_new 2018-09-04 22:49:58.819728759 +0200
@@ -17,7 +17,7 @@
Name: yast2-samba-server
-Version: 4.0.3
+Version: 4.1.0
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -31,8 +31,8 @@
BuildRequires: perl-XML-Writer
BuildRequires: samba-client
BuildRequires: update-desktop-files
-# SuSEFirewall2 replaced by firewalld (fate#323460)
-BuildRequires: yast2 >= 4.0.39
+# Yast2::ServiceWidget
+BuildRequires: yast2 >= 4.1.0
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: yast2-ldap
BuildRequires: yast2-perl-bindings
@@ -41,8 +41,8 @@
BuildRequires: yast2-users
Requires: perl-Crypt-SmbHash
-# SuSEFirewall2 replaced by firewalld (fate#323460)
-Requires: yast2 >= 4.0.39
+# Yast2::ServiceWidget
+Requires: yast2 >= 4.1.0
Requires: yast2-ldap >= 3.1.2
Requires: yast2-network
Requires: yast2-perl-bindings
@@ -58,7 +58,7 @@
Requires: yast2-ruby-bindings >= 1.0.0
Summary: YaST2 - Samba Server Configuration
-License: GPL-2.0
+License: GPL-2.0-only
Group: System/YaST
%description
++++++ yast2-samba-server-4.0.3.tar.bz2 -> yast2-samba-server-4.1.0.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-samba-server-4.0.3/package/yast2-samba-server.changes
new/yast2-samba-server-4.1.0/package/yast2-samba-server.changes
--- old/yast2-samba-server-4.0.3/package/yast2-samba-server.changes
2018-08-03 13:22:34.000000000 +0200
+++ new/yast2-samba-server-4.1.0/package/yast2-samba-server.changes
2018-08-21 17:51:44.000000000 +0200
@@ -1,4 +1,22 @@
-------------------------------------------------------------------
+Mon Aug 20 16:09:08 CEST 2018 - [email protected]
+
+- Switched license in spec file from SPDX2 to SPDX3 format.
+
+-------------------------------------------------------------------
+Mon Aug 13 10:58:01 UTC 2018 - [email protected]
+
+- Use Yast2::ServiceWidget to manage the service status
+ (part of fate#319428)
+- 4.1.0
+
+-------------------------------------------------------------------
+Mon Aug 13 10:39:59 UTC 2018 - [email protected]
+
+- Fix package building with yast2 4.0.84 (bsc#1104644).
+- 4.0.4
+
+-------------------------------------------------------------------
Fri Aug 3 09:45:19 UTC 2018 - [email protected]
- Fix package building with yast2 4.0.80 (bsc#1103691).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-samba-server-4.0.3/package/yast2-samba-server.spec
new/yast2-samba-server-4.1.0/package/yast2-samba-server.spec
--- old/yast2-samba-server-4.0.3/package/yast2-samba-server.spec
2018-08-03 13:22:34.000000000 +0200
+++ new/yast2-samba-server-4.1.0/package/yast2-samba-server.spec
2018-08-21 17:51:44.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-samba-server
-Version: 4.0.3
+Version: 4.1.0
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -25,7 +25,7 @@
Url: https://github.com/yast/yast-samba-server
Group: System/YaST
-License: GPL-2.0
+License: GPL-2.0-only
# Service.Active
BuildRequires: libsmbclient-devel
BuildRequires: perl-Crypt-SmbHash
@@ -33,8 +33,8 @@
BuildRequires: perl-XML-Writer
BuildRequires: samba-client
BuildRequires: update-desktop-files
-# SuSEFirewall2 replaced by firewalld (fate#323460)
-BuildRequires: yast2 >= 4.0.39
+# Yast2::ServiceWidget
+BuildRequires: yast2 >= 4.1.0
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: yast2-ldap
BuildRequires: yast2-perl-bindings
@@ -43,8 +43,8 @@
BuildRequires: yast2-users
Requires: perl-Crypt-SmbHash
-# SuSEFirewall2 replaced by firewalld (fate#323460)
-Requires: yast2 >= 4.0.39
+# Yast2::ServiceWidget
+Requires: yast2 >= 4.1.0
Requires: yast2-ldap >= 3.1.2
Requires: yast2-perl-bindings
Requires: yast2-network
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-samba-server-4.0.3/src/include/samba-server/complex.rb
new/yast2-samba-server-4.1.0/src/include/samba-server/complex.rb
--- old/yast2-samba-server-4.0.3/src/include/samba-server/complex.rb
2018-08-03 13:22:34.000000000 +0200
+++ new/yast2-samba-server-4.1.0/src/include/samba-server/complex.rb
2018-08-21 17:51:44.000000000 +0200
@@ -26,6 +26,10 @@
# Lukas Ocilka <[email protected]>
#
# $Id$
+
+require "yast2/system_service"
+require "yast2/compound_service"
+
module Yast
module SambaServerComplexInclude
def initialize_samba_server_complex(include_target)
@@ -39,10 +43,21 @@
Yast.import "Report"
Yast.import "FileUtils"
Yast.import "Popup"
+ Yast.import "Mode"
Yast.include include_target, "samba-server/helps.rb"
end
+ # Services to configure
+ #
+ # @return [Yast2::CompoundService]
+ def services
+ @services ||= Yast2::CompoundService.new(
+ Yast2::SystemService.find("nmb"),
+ Yast2::SystemService.find("smb")
+ )
+ end
+
# Read settings dialog
# @return `abort if aborted and `next otherwise
def ReadDialog
@@ -63,26 +78,27 @@
end
# Write settings dialog
- # @return `abort if aborted and `next otherwise
+ #
+ # @return [Symbol] :next when service is saved successfully
+ # :abort otherwise
def WriteDialog
Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
# Bugzilla #120080 - 'reload' instead of 'restart'
- # If there some connected users, SAMBA is running and should be running
also after the Write() operation
- # and the Progress was turned on before Writing SAMBA conf
- connected_users = SambaService.ConnectedUsers
- Builtins.y2milestone(
- "Number of connected users: %1",
- Builtins.size(connected_users)
- )
- report_restart_popup = Ops.greater_than(Builtins.size(connected_users),
0) &&
+ # If there some connected users, SAMBA is running and should be running
+ # also after the Write() operation and the Progress was turned on before
+ # Writing SAMBA conf
+ connected_users = SambaService.ConnectedUsers.count
+ Builtins.y2milestone("Number of connected users: %1", connected_users)
+
+ switch_to_reload = connected_users > 0 &&
SambaService.GetServiceRunning &&
SambaService.GetServiceAutoStart &&
ProgressStatus()
- ret = SambaServer.Write(false)
+ ret = save_status(switch_to_reload)
# If popup should be shown and SAMBA is still/again running
- if report_restart_popup && SambaService.GetServiceRunning
+ if switch_to_reload && SambaService.GetServiceRunning
# TRANSLATORS: a popup message
Report.Message(
_(
@@ -95,5 +111,26 @@
end
ret ? :next : :abort
end
+
+ # Saves service status (start mode and starts/stops the service)
+ #
+ # @note For AutoYaST and for command line actions, it uses the old way for
+ # backward compatibility, see {SambaServer#Write}. When the service is
+ # configured using the UI, it is directly saved. See
+ # {Yast2::SystemService#save}.
+ #
+ # @param switch_to_reload [Boolean] indicates if restart action must be
+ # replaced with reload. See the Bugzilla #120080 stated in #WriteDialog
+ # comments
+ #
+ # @return [Boolean] true if service is saved successfully; false otherwise
+ def save_status(switch_to_reload)
+ if Mode.auto || Mode.commandline
+ SambaServer.Write(false)
+ else
+ services.reload if services.action == :restart && switch_to_reload
+ services.save
+ end
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-samba-server-4.0.3/src/include/samba-server/dialogs.rb
new/yast2-samba-server-4.1.0/src/include/samba-server/dialogs.rb
--- old/yast2-samba-server-4.0.3/src/include/samba-server/dialogs.rb
2018-08-03 13:22:34.000000000 +0200
+++ new/yast2-samba-server-4.1.0/src/include/samba-server/dialogs.rb
2018-08-21 17:51:44.000000000 +0200
@@ -26,8 +26,12 @@
# Lukas Ocilka <[email protected]>
#
# $Id$
+
+require "cwm/service_widget"
+
module Yast
module SambaServerDialogsInclude
+
def initialize_samba_server_dialogs(include_target)
Yast.import "UI"
@@ -87,6 +91,16 @@
@btrfs_available = nil
end
+ # Widget to define status and start mode of the services
+ #
+ # There are two involved services, `smb` and `nmb`. See
+ # {Yast::SambaServerComplexInclude#services}
+ #
+ # @return [::CWM::ServiceWidget]
+ def service_widget
+ @service_widget ||= ::CWM::ServiceWidget.new(services)
+ end
+
# routines
# check if snapper support is available (initial check)
@@ -1167,7 +1181,7 @@
100,
VBox(
VSpacing(1),
- "SERVICE START",
+ "service_widget",
VSpacing(1),
"FIREWALL",
VStretch()
@@ -1175,7 +1189,7 @@
),
HWeight(2, Empty())
),
- "widget_names" => ["SERVICE START", "FIREWALL"]
+ "widget_names" => ["service_widget", "FIREWALL"]
},
"shares" => {
"header" => _("&Shares"),
@@ -1267,18 +1281,7 @@
)
tabs_widget_descr = {
- "SERVICE START" => CWMServiceStart.CreateAutoStartWidget(
- {
- "get_service_auto_start" => fun_ref(
- SambaService.method(:GetServiceAutoStart),
- "boolean ()"
- ),
- "set_service_auto_start" => fun_ref(
- SambaService.method(:SetServiceAutoStart),
- "void (boolean)"
- )
- }
- ),
+ "service_widget" => service_widget.cwm_definition,
# BNC #247344, BNC #541958 (comment #18)
"FIREWALL" =>
CWMFirewallInterfaces.CreateOpenFirewallWidget(
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-samba-server-4.0.3/test/dialog_complex_test.rb
new/yast2-samba-server-4.1.0/test/dialog_complex_test.rb
--- old/yast2-samba-server-4.0.3/test/dialog_complex_test.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-samba-server-4.1.0/test/dialog_complex_test.rb 2018-08-21
17:51:44.000000000 +0200
@@ -0,0 +1,189 @@
+#!/usr/bin/env rspec
+# encoding: utf-8
+# Copyright (c) [2018] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "test_helper"
+
+require "yast2/system_service"
+require "yast2/compound_service"
+
+Yast.import "Wizard"
+Yast.import "SambaServer"
+Yast.import "SambaService"
+
+describe "SambaServerComplexInclude" do
+ class TestComplexDialog
+ include Yast::I18n
+ include Yast::UIShortcuts
+
+ def initialize
+ Yast.include self, "samba-server/complex.rb"
+ end
+ end
+
+ before do
+ allow(Yast2::SystemService).to
receive(:find).with(anything).and_return(service)
+ allow(Yast2::CompoundService).to receive(:new).and_return(services)
+ allow(services).to receive(:action).and_return(action)
+ end
+
+ let(:service) { instance_double("Yast2::SystemService", save: true, is_a?:
true) }
+ let(:services) { instance_double("Yast2::CompoundService", save: true) }
+ let(:action) { :start }
+
+ describe "#WriteDialog" do
+ subject(:samba) { TestComplexDialog.new }
+
+ let(:connected_users) { ["john", "jane"] }
+ let(:service_running) { false }
+ let(:service_on_boot) { false }
+
+ let(:auto) { false }
+ let(:commandline) { false }
+
+ before do
+ allow(Yast::Mode).to receive(:auto).and_return(auto)
+ allow(Yast::Mode).to receive(:commandline).and_return(commandline)
+
+ allow(Yast::Wizard).to receive(:RestoreHelp)
+
+ allow(Yast::SambaService).to
receive(:ConnectedUsers).and_return(connected_users)
+ allow(Yast::SambaService).to
receive(:GetServiceRunning).and_return(service_running)
+ allow(Yast::SambaService).to
receive(:GetServiceAutoStart).and_return(service_on_boot)
+
+ allow(subject).to receive(:ProgressStatus).and_return(true)
+ end
+
+ shared_examples "old behavior" do
+ it "does not save directly the system service" do
+ expect(service).to_not receive(:save)
+
+ samba.WriteDialog
+ end
+
+ it "calls SambaServer#Write" do
+ expect(Yast::SambaServer).to receive(:Write)
+
+ samba.WriteDialog
+ end
+
+ it "returns :next when SambaServer#Write is performed successfully" do
+ allow(Yast::SambaServer).to receive(:Write).and_return(true)
+
+ expect(samba.WriteDialog).to eq(:next)
+ end
+
+ it "returns :abort when SambaServer#Write fails" do
+ allow(Yast::SambaServer).to receive(:Write).and_return(false)
+
+ expect(samba.WriteDialog).to eq(:abort)
+ end
+
+ context "and service must be restarted" do
+ context "but service is running and there are connected users" do
+ let(:service_running) { true }
+ let(:service_on_boot) { true }
+
+ it "reloads the service instead" do
+ expect(Yast::Report).to receive(:Message)
+
+ samba.WriteDialog
+ end
+ end
+ end
+ end
+
+ context "when running in command line" do
+ let(:commandline) { true }
+
+ include_examples "old behavior"
+ end
+
+ context "when running in AutoYaST mode" do
+ let(:auto) { true }
+
+ include_examples "old behavior"
+ end
+
+ context "when running in UI mode" do
+ it "saves the system service" do
+ expect(services).to receive(:save)
+
+ samba.WriteDialog
+ end
+
+ it "returns :next when sevice is saved successfully" do
+ expect(samba.WriteDialog).to eq(:next)
+ end
+
+ it "returns :abort when fails saving the service" do
+ allow(services).to receive(:save).and_return(false)
+
+ expect(samba.WriteDialog).to eq(:abort)
+ end
+
+ context "and action is :restart" do
+ let(:action) { :restart }
+
+ context "but the service is already running" do
+ let(:service_running) { true }
+ let(:service_on_boot) { true }
+
+ context "with connected users" do
+ it "changes action to :reload" do
+ expect(services).to receive(:reload)
+
+ samba.WriteDialog
+ end
+
+ it "reports a message" do
+ allow(services).to receive(:reload)
+ expect(Yast::Report).to receive(:Message)
+
+ samba.WriteDialog
+ end
+ end
+
+ context "without connected users" do
+ let(:connected_users) { [] }
+
+ it "performs the requested action" do
+ expect(services).to_not receive(:reload)
+
+ samba.WriteDialog
+ end
+ end
+ end
+ end
+
+ context "and action is NOT :restart" do
+ let (:action) { :reload }
+
+ context "and there are connected users" do
+ it "does not report message" do
+ expect(Yast::Report).to_not receive(:Message)
+
+ samba.WriteDialog
+ end
+ end
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-samba-server-4.0.3/test/test_helper.rb
new/yast2-samba-server-4.1.0/test/test_helper.rb
--- old/yast2-samba-server-4.0.3/test/test_helper.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-samba-server-4.1.0/test/test_helper.rb 2018-08-21
17:51:44.000000000 +0200
@@ -0,0 +1,44 @@
+#!/usr/bin/env rspec
+# encoding: utf-8
+
+# Copyright (c) [2018] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)
+
+require "yast"
+
+if ENV["COVERAGE"]
+ require "simplecov"
+ SimpleCov.start do
+ # Don't measure coverage of the tests themselves.
+ add_filter "/test/"
+ end
+ # track all ruby files under src
+ src_location = File.expand_path("../../src", __FILE__)
+ SimpleCov.track_files("#{src_location}/**/*.rb")
+ # use coveralls for on-line code coverage reporting at Travis CI
+ if ENV["TRAVIS"]
+ require "coveralls"
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
+ SimpleCov::Formatter::HTMLFormatter,
+ Coveralls::SimpleCov::Formatter
+ ]
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-samba-server-4.0.3/testsuite/YaPI/tests/YaPI-GetServiceStatus.out
new/yast2-samba-server-4.1.0/testsuite/YaPI/tests/YaPI-GetServiceStatus.out
--- old/yast2-samba-server-4.0.3/testsuite/YaPI/tests/YaPI-GetServiceStatus.out
2018-08-03 13:22:34.000000000 +0200
+++ new/yast2-samba-server-4.1.0/testsuite/YaPI/tests/YaPI-GetServiceStatus.out
2018-08-21 17:51:44.000000000 +0200
@@ -1,8 +1,8 @@
Return Disabled service
-Execute .target.bash_output " LANG=C TERM=dumb COLUMNS=1024 systemctl
--no-legend --no-pager --no-ask-password show smb.service --property=Id
--property=MainPID --property=Description --property=LoadState
--property=ActiveState --property=SubState --property=UnitFileState
--property=FragmentPath --property=CanReload --property=TriggeredBy "
$["exit":0, "stderr":"", "stdout":""]
+Execute .target.bash_output " LANG=C TERM=dumb COLUMNS=1024 systemctl
--no-legend --no-pager --no-ask-password show smb.service --property=Id
--property=MainPID --property=Description --property=LoadState
--property=ActiveState --property=SubState --property=UnitFileState
--property=FragmentPath --property=CanReload " $["exit":0, "stderr":"",
"stdout":""]
Execute .target.bash_output " LANG=C TERM=dumb COLUMNS=1024 systemctl
--no-legend --no-pager --no-ask-password is-enabled smb.service " $["exit":0,
"stderr":"", "stdout":""]
Return 0
Return Enabled service
-Execute .target.bash_output " LANG=C TERM=dumb COLUMNS=1024 systemctl
--no-legend --no-pager --no-ask-password show smb.service --property=Id
--property=MainPID --property=Description --property=LoadState
--property=ActiveState --property=SubState --property=UnitFileState
--property=FragmentPath --property=CanReload --property=TriggeredBy "
$["exit":0, "stderr":"", "stdout":""]
+Execute .target.bash_output " LANG=C TERM=dumb COLUMNS=1024 systemctl
--no-legend --no-pager --no-ask-password show smb.service --property=Id
--property=MainPID --property=Description --property=LoadState
--property=ActiveState --property=SubState --property=UnitFileState
--property=FragmentPath --property=CanReload " $["exit":0, "stderr":"",
"stdout":""]
Execute .target.bash_output " LANG=C TERM=dumb COLUMNS=1024 systemctl
--no-legend --no-pager --no-ask-password is-enabled smb.service " $["exit":0,
"stderr":"", "stdout":""]
Return 0