Hello community,
here is the log from the commit of package yast2-iscsi-client for
openSUSE:Factory checked in at 2018-08-13 10:29:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-iscsi-client (Old)
and /work/SRC/openSUSE:Factory/.yast2-iscsi-client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-iscsi-client"
Mon Aug 13 10:29:04 2018 rev:117 rq:628641 version:4.1.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-iscsi-client/yast2-iscsi-client.changes
2018-07-03 23:31:09.968683646 +0200
+++
/work/SRC/openSUSE:Factory/.yast2-iscsi-client.new/yast2-iscsi-client.changes
2018-08-13 10:29:16.423073393 +0200
@@ -1,0 +2,13 @@
+Tue Aug 7 11:52:21 UTC 2018 - [email protected]
+
+- Use Yast2::ServiceWidget to manage the service status
+ (part of fate#319428)
+- 4.1.0
+
+-------------------------------------------------------------------
+Fri Aug 3 11:56:56 UTC 2018 - [email protected]
+
+- Fix detection of service current status (bsc#1103681).
+- 4.0.2
+
+-------------------------------------------------------------------
Old:
----
yast2-iscsi-client-4.0.1.tar.bz2
New:
----
yast2-iscsi-client-4.1.0.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-iscsi-client.spec ++++++
--- /var/tmp/diff_new_pack.BEe480/_old 2018-08-13 10:29:18.071076733 +0200
+++ /var/tmp/diff_new_pack.BEe480/_new 2018-08-13 10:29:18.075076741 +0200
@@ -17,26 +17,25 @@
Name: yast2-iscsi-client
-Version: 4.0.1
+Version: 4.1.0
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2
-# Service module switched to systemd
+# Yast2::SystemService
BuildRequires: docbook-xsl-stylesheets
BuildRequires: libxslt
BuildRequires: update-desktop-files
BuildRequires: yast2 >= 2.23.15
+BuildRequires: yast2 >= 4.1.0
BuildRequires: yast2-devtools >= 3.1.10
BuildRequires: rubygem(rspec)
Requires: yast2-packager
-# network needs Wizard::OpenCancelOKDialog()
-# function from yast2-2.18.2
-# Wizard::SetDesktopTitleAndIcon
-Requires: yast2 >= 2.21.22
+# Yast2::SystemService
+Requires: yast2 >= 4.1.0
BuildArch: noarch
++++++ yast2-iscsi-client-4.0.1.tar.bz2 -> yast2-iscsi-client-4.1.0.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-client-4.0.1/package/yast2-iscsi-client.changes
new/yast2-iscsi-client-4.1.0/package/yast2-iscsi-client.changes
--- old/yast2-iscsi-client-4.0.1/package/yast2-iscsi-client.changes
2018-07-02 16:11:22.000000000 +0200
+++ new/yast2-iscsi-client-4.1.0/package/yast2-iscsi-client.changes
2018-08-10 16:21:31.000000000 +0200
@@ -1,4 +1,17 @@
-------------------------------------------------------------------
+Tue Aug 7 11:52:21 UTC 2018 - [email protected]
+
+- Use Yast2::ServiceWidget to manage the service status
+ (part of fate#319428)
+- 4.1.0
+
+-------------------------------------------------------------------
+Fri Aug 3 11:56:56 UTC 2018 - [email protected]
+
+- Fix detection of service current status (bsc#1103681).
+- 4.0.2
+
+-------------------------------------------------------------------
Wed Jun 27 12:40:11 CEST 2018 - [email protected]
- Added additional searchkeys to desktop file (fate#321043).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-client-4.0.1/package/yast2-iscsi-client.spec
new/yast2-iscsi-client-4.1.0/package/yast2-iscsi-client.spec
--- old/yast2-iscsi-client-4.0.1/package/yast2-iscsi-client.spec
2018-07-02 16:11:22.000000000 +0200
+++ new/yast2-iscsi-client-4.1.0/package/yast2-iscsi-client.spec
2018-08-10 16:21:31.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-iscsi-client
-Version: 4.0.1
+Version: 4.1.0
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -25,7 +25,8 @@
Group: System/YaST
License: GPL-2.0
-# Service module switched to systemd
+# Yast2::SystemService
+BuildRequires: yast2 >= 4.1.0
BuildRequires: yast2 >= 2.23.15
BuildRequires: docbook-xsl-stylesheets libxslt update-desktop-files
BuildRequires: yast2-devtools >= 3.1.10
@@ -33,10 +34,8 @@
Requires: yast2-packager
-# network needs Wizard::OpenCancelOKDialog()
-# function from yast2-2.18.2
-# Wizard::SetDesktopTitleAndIcon
-Requires: yast2 >= 2.21.22
+# Yast2::SystemService
+Requires: yast2 >= 4.1.0
BuildArchitectures: noarch
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-client-4.0.1/src/include/iscsi-client/complex.rb
new/yast2-iscsi-client-4.1.0/src/include/iscsi-client/complex.rb
--- old/yast2-iscsi-client-4.0.1/src/include/iscsi-client/complex.rb
2018-07-02 16:11:22.000000000 +0200
+++ new/yast2-iscsi-client-4.1.0/src/include/iscsi-client/complex.rb
2018-08-10 16:21:31.000000000 +0200
@@ -67,12 +67,18 @@
end
# Write settings dialog
- # @return `abort if aborted and `next otherwise
+ #
+ # @return [Symbol] :abort if aborted, :next otherwise
def WriteDialog
- Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
- # IscsiClient::AbortFunction = PollAbort;
- ret = IscsiClient.Write
- ret ? :next : :abort
+ help = @HELPS.fetch("write") { "" }
+
+ Wizard.CreateDialog
+ Wizard.RestoreHelp(help)
+ result = IscsiClient.Write
+ Wizard.CloseDialog
+
+ return :next if result
+ :abort
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-client-4.0.1/src/include/iscsi-client/dialogs.rb
new/yast2-iscsi-client-4.1.0/src/include/iscsi-client/dialogs.rb
--- old/yast2-iscsi-client-4.0.1/src/include/iscsi-client/dialogs.rb
2018-07-02 16:11:22.000000000 +0200
+++ new/yast2-iscsi-client-4.1.0/src/include/iscsi-client/dialogs.rb
2018-08-10 16:21:31.000000000 +0200
@@ -29,6 +29,9 @@
# $Id$
#
# Main file for iscsi-client configuration. Uses all other files.
+
+require "cwm/service_widget"
+
module Yast
module IscsiClientDialogsInclude
def initialize_iscsi_client_dialogs(include_target)
@@ -50,34 +53,8 @@
Yast.include include_target, "iscsi-client/widgets.rb"
@widgets = {
- "auto_start_up" => CWMServiceStart.CreateAutoStartWidget(
- {
- "get_service_auto_start" => fun_ref(
- IscsiClientLib.method(:GetStartService),
- "boolean ()"
- ),
- "set_service_auto_start" => fun_ref(
- IscsiClientLib.method(:SetStartService),
- "void (boolean)"
- ),
- # radio button (starting SLP service - option 1)
- "start_auto_button" => _(
- "When &Booting"
- ),
- # radio button (starting SLP service - option 2)
- "start_manual_button" => _(
- "&Manually"
- ),
- "help" => Builtins.sformat(
- CWMServiceStart.AutoStartHelpTemplate,
- # part of help text, used to describe radiobuttons (matching
starting SLP service but without "&")
- _("When Booting"),
- # part of help text, used to describe radiobuttons (matching
starting SLP service but without "&")
- _("Manually")
- )
- }
- ),
- "isns" => {
+ "auto_start_up" => service_widget.cwm_definition,
+ "isns" => {
"widget" => :custom,
"custom_widget" => HBox(
MinWidth(
@@ -384,6 +361,13 @@
}
end
+ # Widget to define state and start mode of the service
+ #
+ # @return [::CWM::ServiceWidget]
+ def service_widget
+ @service_widget ||= ::CWM::ServiceWidget.new(IscsiClient.services)
+ end
+
# main tabbed dialog
def GlobalDialog
if Stage.initial
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-iscsi-client-4.0.1/src/modules/IscsiClient.rb
new/yast2-iscsi-client-4.1.0/src/modules/IscsiClient.rb
--- old/yast2-iscsi-client-4.0.1/src/modules/IscsiClient.rb 2018-07-02
16:11:22.000000000 +0200
+++ new/yast2-iscsi-client-4.1.0/src/modules/IscsiClient.rb 2018-08-10
16:21:31.000000000 +0200
@@ -30,7 +30,10 @@
#
# Representation of the configuration of iscsi-client.
# Input and output routines.
+
require "yast"
+require "yast2/system_service"
+require "yast2/compound_service"
module Yast
class IscsiClientClass < Module
@@ -57,9 +60,9 @@
# Data was modified?
@modified = false
-
@proposal_valid = false
+ # FIXME: write_only seems to be not in use
# Write only, used during autoinstallation.
# Don't run services and SuSEconfig, it's all done at one place.
@write_only = false
@@ -69,6 +72,17 @@
@AbortFunction = fun_ref(method(:Modified), "boolean ()")
end
+ # Returns iSCSI related services
+ #
+ # @return [Yast2::CompundService]
+ def services
+ @services ||= Yast2::CompoundService.new(
+ Yast2::SystemService.find("iscsi"),
+ Yast2::SystemService.find("iscsid"),
+ Yast2::SystemService.find("iscsiuio")
+ )
+ end
+
# Abort function
# @return [Boolean] return true if abort
def Abort
@@ -205,9 +219,11 @@
Builtins.sleep(sl)
return false if Abort()
- # Progress::NextStep();
- # read status of service
- return false if !IscsiClientLib.getServiceStatus
+
+ if Mode.auto || Mode.commandline
+ return false unless IscsiClientLib.getServiceStatus
+ end
+
# try auto login to target
IscsiClientLib.autoLogOn
Builtins.sleep(sl)
@@ -216,7 +232,6 @@
# if(!IscsiClientLib::autoLogOn()) return false;
Progress.NextStage
-
# read config file
if IscsiClientLib.readSessions == false
Report.Error(Message.CannotReadCurrentSettings)
@@ -263,7 +278,7 @@
return false if Abort()
Progress.NextStage
# set open-iscsi service status
- return false if !IscsiClientLib.setServiceStatus
+ return false unless save_status
Builtins.sleep(sl)
return false if Abort()
@@ -277,6 +292,20 @@
true
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 {IscsiClientLib#setServiceStatus}. When the
+ # service is configured by using the UI, it directly saves the service, see
+ # {Yast2::SystemService#save}.
+ def save_status
+ if Mode.auto || Mode.commandline
+ IscsiClientLib.setServiceStatus
+ else
+ services.save
+ end
+ end
+
# Get all iscsi-client settings from the first parameter
# (For use by autoinstallation.)
# @param [Hash] settings The YCP structure to be imported.
@@ -315,6 +344,7 @@
publish :function => :Modified, :type => "boolean ()"
publish :variable => :modified, :type => "boolean"
publish :variable => :proposal_valid, :type => "boolean"
+ # FIXME: write_only it is not used anymore
publish :variable => :write_only, :type => "boolean"
publish :variable => :AbortFunction, :type => "boolean ()"
publish :function => :Abort, :type => "boolean ()"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-client-4.0.1/src/modules/IscsiClientLib.rb
new/yast2-iscsi-client-4.1.0/src/modules/IscsiClientLib.rb
--- old/yast2-iscsi-client-4.0.1/src/modules/IscsiClientLib.rb 2018-07-02
16:11:22.000000000 +0200
+++ new/yast2-iscsi-client-4.1.0/src/modules/IscsiClientLib.rb 2018-08-10
16:21:31.000000000 +0200
@@ -1076,6 +1076,11 @@
end
+ # FIXME: this method has too much responsibility and it is doing
+ # "unexpected" things according to its name. Ideally, it only must return
+ # the service status without changing the status of related services and
+ # sockets.
+ #
# get status of iscsid
def getServiceStatus
ret = true
@@ -1096,7 +1101,7 @@
log.info "Status of iscsi.service: #{@iscsi_service_stat},
iscsid.socket: #{@iscsid_socket_stat}, iscsiuio.socket:
#{@iscsiuio_socket_stat}"
# if not running, start iscsi.service, iscsid.socket and
iscsiuio.socket
- if !@iscid_socket_stat
+ if !@iscsid_socket_stat
Service.Stop("iscsid") if Service.active?("iscsid")
log.error "Cannot start iscsid.socket" if
!socketStart(@iscsid_socket)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-iscsi-client-4.0.1/test/iscsi_client_lib_test.rb
new/yast2-iscsi-client-4.1.0/test/iscsi_client_lib_test.rb
--- old/yast2-iscsi-client-4.0.1/test/iscsi_client_lib_test.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-iscsi-client-4.1.0/test/iscsi_client_lib_test.rb 2018-08-10
16:21:31.000000000 +0200
@@ -0,0 +1,76 @@
+#!/usr/bin/env rspec
+
+require_relative "test_helper"
+require_relative "../src/modules/IscsiClientLib"
+
+describe Yast::IscsiClientLibClass do
+ subject { described_class.new }
+
+ describe "#getServiceStatus" do
+ before do
+ allow(Yast::Service).to receive(:Stop).with(anything)
+ allow(Yast::Service).to receive(:active?).with(anything)
+ allow(Yast::SystemdSocket).to receive(:find!).with(anything)
+ allow(subject).to receive(:socketActive?)
+ allow(subject.log).to receive(:error)
+ end
+
+ context "for iscsid.socket" do
+ let(:iscsid_socket) { double("iscsid.socket", start: true) }
+
+ before do
+ allow(Yast::SystemdSocket).to
receive(:find!).with("iscsid").and_return(iscsid_socket)
+ allow(subject).to
receive(:socketActive?).with(iscsid_socket).and_return(socket_status)
+ end
+
+ context "when iscsid.socket and iscsid.service are active" do
+ let(:socket_status) { true }
+
+ before do
+ allow(Yast::Service).to
receive(:active?).with("iscsid").and_return(true)
+ end
+
+ it "does not start the socket nor the service" do
+ expect(iscsid_socket).to_not receive(:start)
+ expect(Yast::Service).to_not receive(:Stop).with("iscsid")
+
+ subject.getServiceStatus
+ end
+ end
+
+ context "when iscsid.socket is not active" do
+ let(:socket_status) { false }
+
+ context "and socket is availbale" do
+ it "starts iscsid.socket" do
+ expect(iscsid_socket).to receive(:start)
+
+ subject.getServiceStatus
+ end
+
+ context "but iscsid.service is active" do
+ before do
+ allow(Yast::Service).to
receive(:active?).with("iscsid").and_return(true)
+ end
+
+ it "stops iscsid.service" do
+ expect(Yast::Service).to receive(:Stop).with("iscsid")
+
+ subject.getServiceStatus
+ end
+ end
+ end
+
+ context "but socket is not availbale" do
+ let(:iscsid_socket) { nil }
+
+ it "logs an error" do
+ expect(subject.log).to receive(:error).with("Cannot start
iscsid.socket")
+
+ subject.getServiceStatus
+ end
+ end
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-iscsi-client-4.0.1/test/iscsi_client_test.rb
new/yast2-iscsi-client-4.1.0/test/iscsi_client_test.rb
--- old/yast2-iscsi-client-4.0.1/test/iscsi_client_test.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-iscsi-client-4.1.0/test/iscsi_client_test.rb 2018-08-10
16:21:31.000000000 +0200
@@ -0,0 +1,150 @@
+#!/usr/bin/env rspec
+
+require_relative "./test_helper"
+require_relative "../src/modules/IscsiClient"
+
+Yast.import "IscsiClient"
+
+describe Yast::IscsiClient do
+ subject(:iscsi_client) { described_class }
+
+ before do
+ allow(Yast2::SystemService).to
receive(:find).with(anything).and_return(service)
+ end
+
+ let(:service) { instance_double(Yast2::SystemService, save: true, is_a?:
true) }
+ let(:services) { instance_double(Yast2::CompoundService, save: true) }
+ let(:auto) { false }
+ let(:commandline) { false }
+
+ describe "#services" do
+ it "includes iscsi, iscsid, and iscsiuio" do
+ expect(Yast2::SystemService).to receive(:find).with("iscsi")
+ expect(Yast2::SystemService).to receive(:find).with("iscsid")
+ expect(Yast2::SystemService).to receive(:find).with("iscsiuio")
+
+ subject.services
+ end
+
+ it "returns a compound service" do
+ expect(subject.services).to be_a(Yast2::CompoundService)
+ end
+ end
+
+ describe "#Read" do
+ before do
+ allow(Yast::Progress).to receive(:New)
+ allow(Yast::Progress).to receive(:NextStage)
+ allow(Yast::Confirm).to receive(:MustBeRoot).and_return(true)
+ allow(Yast::NetworkService).to
receive(:RunnungNetworkPopup).and_return(true)
+ allow(Yast::Builtins).to receive(:sleep)
+ allow(Yast::Builtins).to receive(:y2milestone)
+
+ allow(Yast::IscsiClientLib).to receive(:getiBFT).and_return(true)
+ allow(Yast::IscsiClientLib).to
receive(:checkInitiatorName).and_return(true)
+ allow(Yast::IscsiClientLib).to receive(:autoLogOn)
+ allow(Yast::IscsiClientLib).to receive(:readSession).and_return(true)
+
+ allow(Yast::Mode).to receive(:auto) { auto }
+ allow(Yast::Mode).to receive(:commandline) { commandline }
+
+ allow(iscsi_client).to receive(:Abort).and_return(false)
+ allow(iscsi_client).to receive(:installed_packages).and_return(true)
+
+ iscsi_client.main
+ end
+
+ shared_examples "old behavior" do
+ it "calls to IscsiClientLib#getServiceStatus" do
+ expect(Yast::IscsiClientLib).to receive(:getServiceStatus)
+
+ iscsi_client.Read
+ 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
+ it "does not call to IscsiClientLib#getServiceStatus" do
+ expect(Yast::IscsiClientLib).to_not receive(:getServiceStatus)
+
+ iscsi_client.Read
+ end
+ end
+ end
+
+ describe "#Write" do
+ before do
+ allow(Yast::Progress).to receive(:New)
+ allow(Yast::Progress).to receive(:NextStage)
+ allow(Yast::Report).to receive(:Error)
+ allow(Yast::Builtins).to receive(:sleep)
+ allow(Yast::Stage).to receive(:initial).and_return(false)
+ allow(Yast::Mode).to receive(:auto) { auto }
+ allow(Yast::Mode).to receive(:commandline) { commandline }
+
+ allow(iscsi_client).to receive(:Abort).and_return(false)
+
+ iscsi_client.main
+ end
+
+ shared_examples "old behavior" do
+ before do
+ allow(Yast::IscsiClientLib).to receive(:autoyastPrepare)
+ allow(Yast::IscsiClientLib).to receive(:autoyastWrite)
+ end
+
+ it "does not save the system service" do
+ expect(service).to_not receive(:save)
+
+ iscsi_client.Write
+ end
+
+ it "calls to IscsiClientLib#setServiceStatus" do
+ expect(Yast::IscsiClientLib).to receive(:setServiceStatus)
+
+ iscsi_client.Write
+ 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(iscsi_client).to receive(:services).and_return(services)
+ end
+
+ it "does not call IscsiClientLib#setServiceStatus" do
+ expect(Yast::IscsiClientLib).to_not receive(:setServiceStatus)
+
+ iscsi_client.Write
+ end
+
+ it "saves system services" do
+ expect(services).to receive(:save)
+
+ iscsi_client.Write
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-iscsi-client-4.0.1/test/test_helper.rb
new/yast2-iscsi-client-4.1.0/test/test_helper.rb
--- old/yast2-iscsi-client-4.0.1/test/test_helper.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/yast2-iscsi-client-4.1.0/test/test_helper.rb 2018-08-10
16:21:31.000000000 +0200
@@ -0,0 +1,33 @@
+srcdir = File.expand_path("../../src", __FILE__)
+y2dirs = ENV.fetch("Y2DIR", "").split(":")
+ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":")
+
+require "yast"
+require "yast/rspec"
+
+# Ensure the tests runs with english locales
+ENV["LC_ALL"] = "en_US.UTF-8"
+
+RSpec.configure do |c|
+ c.extend Yast::I18n # available in context/describe
+ c.include Yast::I18n
+end
+
+if ENV["COVERAGE"]
+ require "simplecov"
+ SimpleCov.start do
+ add_filter "/test/"
+ end
+
+ # track all ruby files under src
+ SimpleCov.track_files("#{srcdir}/**/*.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