Hello community, here is the log from the commit of package yast2-isns for openSUSE:Factory checked in at 2018-09-05 13:48:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-isns (Old) and /work/SRC/openSUSE:Factory/.yast2-isns.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-isns" Wed Sep 5 13:48:47 2018 rev:35 rq:631135 version:4.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-isns/yast2-isns.changes 2018-07-03 23:34:33.024391660 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-isns.new/yast2-isns.changes 2018-09-05 13:48:48.214282606 +0200 @@ -1,0 +2,25 @@ +Thu Aug 23 14:31:13 UTC 2018 - dgonza...@suse.com + +- Update calls to YaST2 systemd classes (related to fate#319428) +- 4.1.2 + +------------------------------------------------------------------- +Thu Aug 23 13:34:29 UTC 2018 - dgonza...@suse.com + +- Avoid crash when "open-isns" is not installed yet + (related to fate#319428) +- 4.1.1 + +------------------------------------------------------------------- +Mon Aug 20 15:21:55 CEST 2018 - sch...@suse.de + +- Switched license in spec file from SPDX2 to SPDX3 format. + +------------------------------------------------------------------- +Fri Aug 10 11:08:53 UTC 2018 - jlo...@suse.com + +- Use new Yast2::ServiceWidget to manage the service status + (part of fate#319428). +- 4.1.0 + +------------------------------------------------------------------- Old: ---- yast2-isns-4.0.1.tar.bz2 New: ---- yast2-isns-4.1.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-isns.spec ++++++ --- /var/tmp/diff_new_pack.lAoog4/_old 2018-09-05 13:48:48.754283512 +0200 +++ /var/tmp/diff_new_pack.lAoog4/_new 2018-09-05 13:48:48.754283512 +0200 @@ -17,26 +17,30 @@ Name: yast2-isns -Version: 4.0.1 +Version: 4.1.2 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: %{name}-%{version}.tar.bz2 -# SuSEFirewall2 replaced by firewalld (fate#323460) -Requires: yast2 >= 4.0.39 +# Yast2::Systemd::Service +Requires: yast2 >= 4.1.3 BuildRequires: perl-XML-Writer BuildRequires: update-desktop-files BuildRequires: yast2 BuildRequires: yast2-devtools >= 3.1.10 BuildRequires: yast2-testsuite +BuildRequires: rubygem(%rb_default_ruby_abi:rspec) +BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake) +# Yast2::Systemd::Service +BuildRequires: yast2 >= 4.1.3 BuildArch: noarch Requires: yast2-ruby-bindings >= 1.0.0 Summary: Configuration of isns -License: GPL-2.0 +License: GPL-2.0-only Group: System/YaST %description @@ -45,6 +49,9 @@ %prep %setup -n %{name}-%{version} +%check +rake test:unit + %build %yast_build ++++++ yast2-isns-4.0.1.tar.bz2 -> yast2-isns-4.1.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/package/yast2-isns.changes new/yast2-isns-4.1.2/package/yast2-isns.changes --- old/yast2-isns-4.0.1/package/yast2-isns.changes 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/package/yast2-isns.changes 2018-08-23 17:56:10.000000000 +0200 @@ -1,4 +1,29 @@ ------------------------------------------------------------------- +Thu Aug 23 14:31:13 UTC 2018 - dgonza...@suse.com + +- Update calls to YaST2 systemd classes (related to fate#319428) +- 4.1.2 + +------------------------------------------------------------------- +Thu Aug 23 13:34:29 UTC 2018 - dgonza...@suse.com + +- Avoid crash when "open-isns" is not installed yet + (related to fate#319428) +- 4.1.1 + +------------------------------------------------------------------- +Mon Aug 20 15:21:55 CEST 2018 - sch...@suse.de + +- Switched license in spec file from SPDX2 to SPDX3 format. + +------------------------------------------------------------------- +Fri Aug 10 11:08:53 UTC 2018 - jlo...@suse.com + +- Use new Yast2::ServiceWidget to manage the service status + (part of fate#319428). +- 4.1.0 + +------------------------------------------------------------------- Thu Jun 28 14:58:02 CEST 2018 - sch...@suse.de - Added additional searchkeys to desktop file (fate#321043). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/package/yast2-isns.spec new/yast2-isns-4.1.2/package/yast2-isns.spec --- old/yast2-isns-4.0.1/package/yast2-isns.spec 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/package/yast2-isns.spec 2018-08-23 17:56:10.000000000 +0200 @@ -17,18 +17,22 @@ Name: yast2-isns -Version: 4.0.1 +Version: 4.1.2 Release: 0 -License: GPL-2.0 +License: GPL-2.0-only Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: %{name}-%{version}.tar.bz2 -# SuSEFirewall2 replaced by firewalld (fate#323460) -Requires: yast2 >= 4.0.39 +# Yast2::Systemd::Service +Requires: yast2 >= 4.1.3 BuildRequires: perl-XML-Writer update-desktop-files yast2 yast2-testsuite BuildRequires: yast2-devtools >= 3.1.10 +BuildRequires: rubygem(%rb_default_ruby_abi:yast-rake) +BuildRequires: rubygem(%rb_default_ruby_abi:rspec) +# Yast2::Systemd::Service +BuildRequires: yast2 >= 4.1.3 BuildArchitectures: noarch @@ -42,13 +46,15 @@ %prep %setup -n %{name}-%{version} +%check +rake test:unit + %build %yast_build %install %yast_install - %files %defattr(-,root,root) %dir %{yast_yncludedir}/isns diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/src/include/isns/complex.rb new/yast2-isns-4.1.2/src/include/isns/complex.rb --- old/yast2-isns-4.0.1/src/include/isns/complex.rb 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/src/include/isns/complex.rb 2018-08-23 17:56:10.000000000 +0200 @@ -27,7 +27,26 @@ IsnsServer.Modified end - def ReallyAbort + # Actions to perform when aborting + # + # @note The socket is stopped if the process is going to be aborted + # and it was not active when the process started. + # + # @return [Boolean] true if it should abort; false otherwise + def abort_configuration + abort_config = abort? + + if abort_config && !IsnsServer.socket_initially_active? + IsnsServer.isnsdSocketStop + end + + abort_config + end + + # Shows a confirmation popup when something has been edited + # + # @return [Boolean] true if it should abort; false otherwise + def abort? !IsnsServer.Modified || Popup.ReallyAbort(true) end @@ -36,12 +55,18 @@ end # Read settings dialog - # @return `abort if aborted and `next otherwise + # + # @return [Symbol] :abort when settings could not be read; :next otherwise def ReadDialog Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", "")) - # IsnsServer::AbortFunction = PollAbort; - ret = IsnsServer.Read - ret ? :next : :abort + + return :abort unless IsnsServer.Read + + # Service widget lazy load initialization, since it needs the "open-isns" package which might be + # installed by IsnsServer.Read if is not available + load_service_widget + + :next end # Write settings dialog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/src/include/isns/dialogs.rb new/yast2-isns-4.1.2/src/include/isns/dialogs.rb --- old/yast2-isns-4.0.1/src/include/isns/dialogs.rb 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/src/include/isns/dialogs.rb 2018-08-23 17:56:10.000000000 +0200 @@ -8,6 +8,9 @@ # $Id: isns.ycp 28597 2006-03-06 11:29:38Z mzugec $ # # Main file for isns configuration. Uses all other files. + +require "cwm/service_widget" + module Yast module IsnsDialogsInclude def initialize_isns_dialogs(include_target) @@ -18,7 +21,6 @@ Yast.import "IsnsServer" Yast.import "CWMTab" Yast.import "CWM" - Yast.import "CWMServiceStart" Yast.import "CWMFirewallInterfaces" Yast.import "TablePopup" @@ -38,7 +40,7 @@ HStretch(), HSpacing(1), VBox( - "auto_start_up", + "service_widget", VSpacing(2), "firewall", VSpacing(2) @@ -48,7 +50,7 @@ ), VStretch() ), - "widget_names" => ["auto_start_up", "firewall"] + "widget_names" => ["service_widget", "firewall"] }, # second tab - iSCSI Nodes "members" => { @@ -74,25 +76,6 @@ @widgets = { - "auto_start_up" => CWMServiceStart.CreateAutoStartWidget( - { - "get_service_auto_start" => fun_ref( - IsnsServer.method(:GetStartService), - "boolean ()" - ), - "set_service_auto_start" => fun_ref( - IsnsServer.method(:SetStartService), - "void (boolean)" - ), - "start_auto_button" => _("When &Booting"), - "start_manual_button" => _("&Manually"), - "help" => Builtins.sformat( - CWMServiceStart.AutoStartHelpTemplate, - _("When Booting"), - _("Manually") - ) - } - ), "firewall" => CWMFirewallInterfaces.CreateOpenFirewallWidget( { "services" => ["isns"], "display_details" => true } ), @@ -178,6 +161,25 @@ } end + # Widget to define state and start mode of the service + # + # @return [::CWM::ServiceWidget] + def service_widget + @service_widget ||= ::CWM::ServiceWidget.new(IsnsServer.service) + end + + # Add the service wiget if is not already included + # + # Kind of lazy initialization, since the "open-isns" must be installed in the system. + # Otherwise it crashes + # + # @see Yast::IsnsComplexInclude.ReadDialog + def load_service_widget + return if @widgets.key?("service_widget") + + @widgets["service_widget"] = service_widget.cwm_definition + end + # Summary dialog # @return dialog result # Main dialog - tabbed @@ -226,7 +228,7 @@ ret = CWM.Run( w, - { :abort => fun_ref(method(:ReallyAbort), "boolean ()") } + { :abort => fun_ref(method(:abort_configuration), "boolean ()") } ) ret end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/src/modules/IsnsServer.rb new/yast2-isns-4.1.2/src/modules/IsnsServer.rb --- old/yast2-isns-4.0.1/src/modules/IsnsServer.rb 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/src/modules/IsnsServer.rb 2018-08-23 17:56:10.000000000 +0200 @@ -10,7 +10,9 @@ # Representation of the configuration of iscsi-server. # Input and output routines. require "yast" +require "yast2/system_service" require "y2firewall/firewalld" +require "yast2/systemd/socket" module Yast class IsnsServerClass < Module @@ -28,7 +30,6 @@ Yast.import "Mode" Yast.import "String" Yast.import "Map" - Yast.import "SystemdSocket" @serviceStatus = false @statusOnStart = false @@ -50,6 +51,13 @@ @isnsd_socket = nil end + # Service to configure + # + # @return [Yast2::SystemService] + def service + @service ||= Yast2::SystemService.find("isnsd") + end + def isnsdSocketActive? if @isnsd_socket @isnsd_socket.active? @@ -175,7 +183,7 @@ end # start socket in installed system - @isnsd_socket = SystemdSocket.find!("isnsd") + @isnsd_socket = Yast2::Systemd::Socket.find!("isnsd") if isnsdSocketActive? @statusOnStart = true @@ -293,16 +301,32 @@ end # Write all iscsi-server settings - # @return true on success + # + # @return [Boolean] true on success; false otherwise def Write # IsnsServer write dialog caption caption = _("Saving isns Configuration") Y2Firewall::Firewalld.instance.write - # set isns initscript status - return false if !setServiceStatus - true + if Mode.auto || Mode.commandline + # starts/stops the service (and its socket) according to configuration + setServiceStatus + else + isnsdSocketStop unless socket_initially_active? + service.save + end + end + + # Whether the socket was intially active + # + # This module requires to activate the socket to configure the service properly. + # When the module is launched (see Read), the socket is activated if it was stopped. + # This method checks if the socket was already active at the beginning of the process. + # + # @return [Boolean] + def socket_initially_active? + @statusOnStart end # Return packages needed to be installed and removed during @@ -314,7 +338,8 @@ { "install" => [], "remove" => [] } end - + # @deprecated + # # get/set service accessors for CWMService component def GetStartService status = isnsdSocketEnabled? @@ -322,6 +347,7 @@ status end + # @deprecated def SetStartService(status) y2milestone("Set service status %1", status) @serviceStatus = status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/test/isnsserver_test.rb new/yast2-isns-4.1.2/test/isnsserver_test.rb --- old/yast2-isns-4.0.1/test/isnsserver_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-isns-4.1.2/test/isnsserver_test.rb 2018-08-23 17:56:10.000000000 +0200 @@ -0,0 +1,159 @@ +#!/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 "spec_helper" + +Yast.import "IsnsServer" + +describe "Yast::IsnsServer" do + describe ".Write" do + subject(:isns_server) { Yast::IsnsServerClass.new } + + before do + allow(Y2Firewall::Firewalld).to receive(:instance).and_return(firewalld) + + allow(Yast2::SystemService).to receive(:find).with("isnsd").and_return(service) + + allow(Yast::Mode).to receive(:auto) { auto } + allow(Yast::Mode).to receive(:commandline) { commandline } + + isns_server.main + end + + let(:firewalld) { instance_double(Y2Firewall::Firewalld, write: true) } + + let(:service) { instance_double(Yast2::SystemService, save: true) } + + let(:auto) { false } + let(:commandline) { false } + + shared_examples "old behavior" do + it "does not save the system service" do + allow(isns_server).to receive(:setServiceStatus) + + expect(service).to_not receive(:save) + + isns_server.Write + end + + it "calls to :setServiceStatus" do + expect(isns_server).to receive(:setServiceStatus) + + isns_server.Write + end + + context "and the action is correctly performed" do + before do + allow(isns_server).to receive(:setServiceStatus).and_return(true) + end + + it "returns true" do + expect(isns_server.Write).to eq(true) + end + end + + context "and the action is not correctly performed" do + before do + allow(isns_server).to receive(:setServiceStatus).and_return(false) + end + + it "returns false" do + expect(isns_server.Write).to eq(false) + 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 normal mode" do + before do + allow(isns_server).to receive(:socket_initially_active?).and_return(socket_active) + allow(isns_server).to receive(:isnsdSocketStop) + end + + let(:socket_active) { false } + + it "does not call to :setServiceStatus" do + expect(isns_server).to_not receive(:setServiceStatus) + + isns_server.Write + end + + it "saves the system service" do + expect(service).to receive(:save) + + isns_server.Write + end + + context "and the service is correctly saved" do + before do + allow(service).to receive(:save).and_return(true) + end + + it "returns true" do + expect(isns_server.Write).to eq(true) + end + end + + context "and the service is not correctly saved" do + before do + allow(service).to receive(:save).and_return(false) + end + + it "returns false" do + expect(isns_server.Write).to eq(false) + end + end + + context "and the socket was already active" do + let(:socket_active) { true } + + it "does not try to stop the socket before saving the service" do + expect(isns_server).to_not receive(:isnsdSocketStop) + + isns_server.Write + end + end + + context "and the socket was not active" do + let(:socket_active) { false } + + it "tries to stop the socket before saving the service" do + expect(isns_server).to receive(:isnsdSocketStop).ordered + expect(service).to receive(:save).ordered + + isns_server.Write + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/test/spec_helper.rb new/yast2-isns-4.1.2/test/spec_helper.rb --- old/yast2-isns-4.0.1/test/spec_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-isns-4.1.2/test/spec_helper.rb 2018-08-23 17:56:10.000000000 +0200 @@ -0,0 +1,46 @@ +#!/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-isns-4.0.1/testsuite/Makefile.am new/yast2-isns-4.1.2/testsuite/Makefile.am --- old/yast2-isns-4.0.1/testsuite/Makefile.am 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/testsuite/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -# -# Makefile.am for .../testsuite -# -# Do not edit this file (Makefile.am) as it will be overwritten! -# - -AUTOMAKE_OPTIONS = dejagnu -EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.rb) - -testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite - -all-local: $(testsuite_prepare) - make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) - -clean-local: $(testsuite_prepare) - make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean - -check-local: $(testsuite_prepare) - make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check - -# EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-isns-4.0.1/testsuite/_cvsignore new/yast2-isns-4.1.2/testsuite/_cvsignore --- old/yast2-isns-4.0.1/testsuite/_cvsignore 2018-07-02 18:12:35.000000000 +0200 +++ new/yast2-isns-4.1.2/testsuite/_cvsignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -Makefile -Makefile.in -site.exp -*.sum -*.log -tmp.out* -tmp.err* -tmp.log* -config -run -*.test