Hello community, here is the log from the commit of package yast2-s390 for openSUSE:Factory checked in at 2018-09-25 15:43:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-s390 (Old) and /work/SRC/openSUSE:Factory/.yast2-s390.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-s390" Tue Sep 25 15:43:51 2018 rev:7 rq:637776 version:4.0.5 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-s390/yast2-s390.changes 2018-05-30 12:42:58.933994171 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-s390.new/yast2-s390.changes 2018-09-25 15:43:51.865198098 +0200 @@ -1,0 +2,12 @@ +Fri Sep 21 11:43:00 UTC 2018 - [email protected] + +- Avoid hanging YaST when try to deactivate a DASD in use + (bsc#1091797) +- 4.0.5 + +------------------------------------------------------------------- +Mon Aug 20 09:20:22 CEST 2018 - [email protected] + +- Switched license in spec file from SPDX2 to SPDX3 format. + +------------------------------------------------------------------- Old: ---- yast2-s390-4.0.4.tar.bz2 New: ---- yast2-s390-4.0.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-s390.spec ++++++ --- /var/tmp/diff_new_pack.1WFzeb/_old 2018-09-25 15:43:52.265197671 +0200 +++ /var/tmp/diff_new_pack.1WFzeb/_new 2018-09-25 15:43:52.269197666 +0200 @@ -17,7 +17,7 @@ Name: yast2-s390 -Version: 4.0.4 +Version: 4.0.5 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -40,7 +40,7 @@ Requires: yast2-ruby-bindings >= 3.1.7 Supplements: yast2-storage-ng Summary: YaST2 - S/390 Specific Features Configuration -License: GPL-2.0 +License: GPL-2.0-only Group: System/YaST Url: http://github.com/yast/yast-s390/ ++++++ yast2-s390-4.0.4.tar.bz2 -> yast2-s390-4.0.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.4/package/yast2-s390.changes new/yast2-s390-4.0.5/package/yast2-s390.changes --- old/yast2-s390-4.0.4/package/yast2-s390.changes 2018-05-29 10:32:44.000000000 +0200 +++ new/yast2-s390-4.0.5/package/yast2-s390.changes 2018-09-24 09:42:42.000000000 +0200 @@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Fri Sep 21 11:43:00 UTC 2018 - [email protected] + +- Avoid hanging YaST when try to deactivate a DASD in use + (bsc#1091797) +- 4.0.5 + +------------------------------------------------------------------- +Mon Aug 20 09:20:22 CEST 2018 - [email protected] + +- Switched license in spec file from SPDX2 to SPDX3 format. + +------------------------------------------------------------------- Tue May 08 14:01:56 CEST 2018 - [email protected] - disable mdadm auto assemble during DASD dialog (bsc#1089645) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.4/package/yast2-s390.spec new/yast2-s390-4.0.5/package/yast2-s390.spec --- old/yast2-s390-4.0.4/package/yast2-s390.spec 2018-05-29 10:32:44.000000000 +0200 +++ new/yast2-s390-4.0.5/package/yast2-s390.spec 2018-09-24 09:42:42.000000000 +0200 @@ -17,14 +17,14 @@ Name: yast2-s390 -Version: 4.0.4 +Version: 4.0.5 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: %{name}-%{version}.tar.bz2 Group: System/YaST -License: GPL-2.0 +License: GPL-2.0-only BuildRequires: yast2 BuildRequires: yast2-devtools BuildRequires: yast2-ruby-bindings >= 3.1.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.4/src/modules/DASDController.rb new/yast2-s390-4.0.5/src/modules/DASDController.rb --- old/yast2-s390-4.0.4/src/modules/DASDController.rb 2018-05-29 10:32:44.000000000 +0200 +++ new/yast2-s390-4.0.5/src/modules/DASDController.rb 2018-09-24 09:42:42.000000000 +0200 @@ -29,6 +29,7 @@ # Representation of the configuration of controller. # Input and output routines. require "yast" +require "yast2/popup" require "shellwords" module Yast @@ -465,84 +466,42 @@ when 0 when 1 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: sysfs not mounted."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: sysfs not mounted."), channel)) when 2 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: Invalid status for <online>."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: Invalid status for <online>."), channel)) when 3 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: No device found for <ccwid>."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: No device found for <ccwid>."), channel)) when 4 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: Could not change state of the device."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: Could not change state of the device."), channel)) when 5 # https://bugzilla.novell.com/show_bug.cgi?id=446998#c15 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: Device is not a DASD."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: Device is not a DASD."), channel)) when 6 # https://bugzilla.novell.com/show_bug.cgi?id=446998#c15 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: Could not load module."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: Could not load module."), channel)) when 7 # http://bugzilla.novell.com/show_bug.cgi?id=561876#c8 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: Failed to activate DASD."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: Failed to activate DASD."), channel)) when 8 # http://bugzilla.novell.com/show_bug.cgi?id=561876#c8 - Report.Error( - Builtins.sformat( - # error report, %1 is device identification - _("%1: DASD is not formatted."), - channel - ) - ) + # error report, %1 is device identification + Report.Error(Builtins.sformat(_("%1: DASD is not formatted."), channel)) + when 16 + # https://bugzilla.suse.com/show_bug.cgi?id=1091797#c8 + # TRANSLATORS: error report, %1 is device identification + message = Builtins.sformat(_("%1 DASD is in use and cannot be deactivated."), channel) + report_error(_("Error: channel in use"), message, output_details(ret)) else - Report.Error( - Builtins.sformat( - # error report, %1 is device identification, %2 is integer code - _("%1: Unknown error %2.\nstderr:%3\nstdout:%4"), - channel, - ret["exit"], - ret["stderr"], - ret["stdout"] - ) - ) + # TRANSLATORS: error message, %1 is device identification, %2 is an integer code + message = Builtins.sformat(_("%1 Unknown error %2"), channel, ret["exit"]) + report_error(message, _("Unknown error"), output_details(ret)) end nil @@ -589,7 +548,7 @@ # @param [Boolean] diag boolean Activate DIAG or not def DeactivateDisk(channel, diag) command = Builtins.sformat( - "/sbin/dasd_configure '%1' %2 %3", + "/sbin/dasd_configure '%1' %2 %3 < /dev/null", channel, 0, diag ? 1 : 0 @@ -854,6 +813,32 @@ stderr end + + # Returns an string containing the available stdout and/or stderr + # + # @param ret [Hash] + # @return [String] + def output_details(ret) + output = { + stderr: ret["stderr"].to_s.strip, + stdout: ret["stdout"].to_s.strip + } + + output.map { |k, v| "#{k}: #{v}" unless v.empty? }.compact.join("\n\n") + end + + # Reports the error in the proper way + # + # When an error has details to give more feedback, it is preferable to display it in a Popup + # unless the code has been executed by AutoYaST, in which case the Yast::Report.Error must be + # used to avoid blocking it. + def report_error(headline, message, details) + if Mode.auto || details.empty? + Report.Error("#{message}\n#{details}") + else + Yast2::Popup.show(message, headline: headline, details: details) + end + end end DASDController = DASDControllerClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-s390-4.0.4/test/dasd_controller_test.rb new/yast2-s390-4.0.5/test/dasd_controller_test.rb --- old/yast2-s390-4.0.4/test/dasd_controller_test.rb 2018-05-29 10:32:44.000000000 +0200 +++ new/yast2-s390-4.0.5/test/dasd_controller_test.rb 2018-09-24 09:42:42.000000000 +0200 @@ -7,6 +7,105 @@ describe "Yast::DASDController" do subject { Yast::DASDController } + describe "#DeactivateDisk" do + let(:auto) { false } + let(:channel) { "0.0.0160" } + let(:diagnose) { false } + let(:exit_code) { 0 } + let(:command_result) { { "exit" => exit_code } } + + before do + allow(Yast::Mode).to receive(:auto).and_return(auto) + allow(Yast::Report).to receive(:Error) + allow(Yast2::Popup).to receive(:show) + allow(Yast::SCR).to receive(:Execute).and_return(command_result) + allow(Yast::SCR).to receive(:Read) + .with(Yast.path(".probe.disk")).once + .and_return(load_data("probe_disk_dasd.yml")) + + subject.ProbeDisks() + end + + it "redirects output to /dev/null" do + expect(Yast::SCR).to receive(:Execute) + .with(anything, /\/sbin\/dasd_configure .* < \/dev\/null/) + + subject.DeactivateDisk(channel, diagnose) + end + + context "whit unknown exit code" do + let(:command_result) do + { + "exit" => exit_code, + "stderr" => "Warning: ECKD DASD 0.0.0150 is unknown!\n" \ + "The following unknown resources may be affected:\n" \ + "- Mount point /unknown\n", + "stdout" => "Continue with operation? (yes/no)" + } + end + let(:exit_code) { "unknown" } + + it "reports an error with details" do + expect(Yast2::Popup).to receive(:show).with(anything, hash_including(:headline, :details)) + + subject.DeactivateDisk(channel, diagnose) + end + + context "but in Mode.auto" do + let(:auto) { true } + + it "reports the error throught Yast::Report" do + expect(Yast::Report).to receive(:Error) + + subject.DeactivateDisk(channel, diagnose) + end + end + end + + context "when disk is being in use" do + let(:exit_code) { 16 } + let(:command_result) do + { + "exit" => exit_code, + "stderr" => "Warning: ECKD DASD 0.0.0150 is in use!\n" \ + "The following resources may be affected:\n" \ + "- Mount point /mnt\n", + "stdout" => "Continue with operation? (yes/no)" + } + end + + it "returns nil" do + expect(subject.DeactivateDisk(channel, diagnose)).to be_nil + end + + it "reports an error using a popup with details" do + expect(Yast2::Popup).to receive(:show).with(anything, hash_including(:headline, :details)) + + subject.DeactivateDisk(channel, diagnose) + end + + context "but in Mode.auto" do + let(:auto) { true } + + it "reports the error throught Yast::Report" do + expect(Yast::Report).to receive(:Error).with(/in use/) + + subject.DeactivateDisk(channel, diagnose) + end + end + + context "but there are not details to show" do + let(:command_result) { { "exit" => exit_code } } + + it "reports an error throught Yast::Report" do + expect(Yast::Report).to receive(:Error).with(/in use/) + + subject.DeactivateDisk(channel, diagnose) + end + end + end + end + describe "#IsAvailable" do it "returns true if .probe.disk contains DASDs" do expect(Yast::SCR).to receive(:Read).with(Yast.path(".probe.disk")).once
