Skip to content

Commit

Permalink
Merge pull request #699 from yast/merge-sle-15-ga
Browse files Browse the repository at this point in the history
Merge SLE-15-GA
  • Loading branch information
imobachgs committed May 11, 2018
2 parents 0c25171 + 529f2a2 commit 0594565
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 36 deletions.
27 changes: 27 additions & 0 deletions package/yast2-installation.changes
@@ -1,3 +1,30 @@
-------------------------------------------------------------------
Thu May 10 13:10:41 UTC 2018 - igonzalezsosa@suse.com

- Log a warning when umounting a filesystem fails after
installation/upgrade (related to bsc#1090018).
- 4.0.59

-------------------------------------------------------------------
Tue May 08 12:04:00 CEST 2018 - aschnell@suse.com

- disable mdadm auto assembly for installation (bsc#1090690)
- 4.0.58

-------------------------------------------------------------------
Thu May 3 07:34:57 UTC 2018 - lslezak@suse.cz

- Keep the selected product in the desktop selection dialog
(bsc#1088660)
- 4.0.57

-------------------------------------------------------------------
Wed May 2 15:44:18 UTC 2018 - shundhammer@suse.com

- Copy new /var/log/YaST2/storage-inst/ subdir to target at the
end of the installation (part of fate #318196)
- 4.0.56

-------------------------------------------------------------------
Fri Apr 27 15:07:15 UTC 2018 - igonzalezsosa@suse.com

Expand Down
8 changes: 4 additions & 4 deletions package/yast2-installation.spec
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-installation
Version: 4.0.55
Version: 4.0.59
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -47,9 +47,9 @@ BuildRequires: yast2 >= 4.0.72
# Yast::Packages.check_remote_installation_packages
BuildRequires: yast2-packager >= 4.0.9

# Y2Storage::StorageManager#devices_for_installation?
BuildRequires: yast2-storage-ng >= 4.0.168
Requires: yast2-storage-ng >= 4.0.168
# Y2Storage::Inhibitors
BuildRequires: yast2-storage-ng >= 4.0.175
Requires: yast2-storage-ng >= 4.0.175

# TextHelpers#div_with_direction
Requires: yast2 >= 4.0.72
Expand Down
1 change: 1 addition & 0 deletions src/lib/installation/clients/inst_complex_welcome.rb
Expand Up @@ -195,6 +195,7 @@ def license_confirmation_required?
# agreement confirmed when required; false otherwise
def product_selection_finished?
if selected_product.nil?
return true if products.size <= 1
Yast::Popup.Error(_("Please select a product to install."))
return false
elsif license_confirmation_required? && !selected_product.license_confirmed?
Expand Down
12 changes: 12 additions & 0 deletions src/lib/installation/clients/inst_system_analysis.rb
Expand Up @@ -27,6 +27,7 @@

require "yast"
require "y2storage"
require "y2storage/inhibitors"

module Yast
class InstSystemAnalysisClient < Client
Expand Down Expand Up @@ -64,6 +65,7 @@ def main
return :back if GetInstArgs.going_back

@packager_initialized = false
@inhibitors = nil

Wizard.SetContents(_("Analyzing the Computer"), Empty(), "", false, false)
Wizard.SetTitleIcon("yast-controller")
Expand Down Expand Up @@ -177,6 +179,8 @@ def ActionFireWire
# @raise [AbortException] if an error is found and the installation must
# be aborted because of such error
def ActionHDDProbe
inhibit_storage

init_storage
devicegraph = storage_manager.probed

Expand Down Expand Up @@ -253,6 +257,14 @@ def FilesFromOlderSystems

private

# Inhibit various storage features, e.g. MD RAID auto assembly
def inhibit_storage
return if @inhibitors

@inhibitors = Y2Storage::Inhibitors.new
@inhibitors.inhibit
end

# Return the activate callbacks for libstorage-ng
#
# When running AutoYaST, it will use a different set of callbacks.
Expand Down
30 changes: 17 additions & 13 deletions src/lib/installation/clients/umount_finish.rb
Expand Up @@ -159,14 +159,7 @@ def main
WFM.Execute(path(".local.umount"), umount_this)
)
if umount_result != true
# run "fuser" to get the details about open files
# (the details are printed on STDERR, redirect it)
fuser = begin
`LC_ALL=C fuser -v -m #{Shellwords.escape(umount_this)} 2>&1`
rescue => e
"fuser failed: #{e}"
end
log.warn("Running processes using #{umount_this}: #{fuser}")
log_running_processes(umount_this)
# bnc #395034
# Don't remount them read-only!
if Builtins.contains(
Expand Down Expand Up @@ -248,6 +241,7 @@ def main
# bnc #395034
# Don't remount them read-only!
next if @umount_status
log_running_processes(@tmp)

if Builtins.contains(
["/proc", "/sys", "/dev", "/proc/bus/usb"],
Expand Down Expand Up @@ -281,11 +275,7 @@ def main
WFM.Execute(path(".local.bash_output"), "mount")
)

@cmd = Builtins.sformat(
"fuser -v '%1' 2>&1",
String.Quote(Installation.destdir)
)
@cmd_run = Convert.to_map(WFM.Execute(path(".local.bash_output"), @cmd))
log_running_processes(Installation.destdir)

# storage-ng
=begin
Expand Down Expand Up @@ -441,5 +431,19 @@ def default_subvolume_as_ro(fs)
log.info("Setting root subvol read-only property on #{subvolume_path}")
Yast::Execute.on_target("btrfs", "property", "set", subvolume_path, "ro", "true")
end

# run "fuser" to get the details about open files
#
# @param mount_point [String]
def log_running_processes(mount_point)
fuser =
begin
# (the details are printed on STDERR, redirect it)
`LC_ALL=C fuser -v -m #{Shellwords.escape(mount_point)} 2>&1`
rescue => e
"fuser failed: #{e}"
end
log.warn("Running processes using #{mount_point}: #{fuser}")
end
end
end
40 changes: 26 additions & 14 deletions src/lib/installation/copy_logs_finish.rb
Expand Up @@ -47,6 +47,8 @@ def modes
end

PREFIX_SIZE = "y2log-".size
STORAGE_DUMP_DIR = "storage-inst".freeze

def write
log_files = Yast::WFM.Read(Yast::Path.new(".local.dir"), Yast::Directory.logdir)

Expand All @@ -70,38 +72,48 @@ def write
)
# call gzip with -f to avoid stuck during race condition when log
# rotator also gzip file and gzip then wait for input (bnc#897091)
compress_cmd = "gzip -f #{target_path}"
log.debug "Compress command: #{compress_cmd}"
Yast::WFM.Execute(LOCAL_BASH, compress_cmd)
shell_cmd("/usr/bin/gzip -f '#{target_path}'")
when /\Ay2log-\d+\.gz\z/
target_no = file[/y2log-(\d+)/, 1].to_i + 1
copy_log_to_target(file, "y2log-#{target_no}.gz")
when "zypp.log"
# Save zypp.log from the inst-sys
copy_log_to_target(file, "zypp.log-1") # not y2log, y2log-*
when "pbl.log"
copy_log_to_target("pbl.log", "pbl-instsys.log")
when STORAGE_DUMP_DIR
copy_storage_inst_subdir
else
copy_log_to_target(file)
end
end

copy_cmd = "/bin/cp /var/log/pbl.log '#{Yast::Installation.destdir}/#{Yast::Directory.logdir}/pbl-instsys.log'"
log.debug "Copy command: #{copy_cmd}"
Yast::WFM.Execute(LOCAL_BASH, copy_cmd)

nil
end

private

def copy_log_to_target(src_file, dst_file = src_file)
dir = Yast::Directory.logdir
src_path = "#{dir}/#{src_file}"
dst_path = "#{Yast::Installation.destdir}/#{dir}/#{dst_file}"
command = "/bin/cp #{src_path} #{dst_path}"
def copy_log_to_target(src_file, dest_file = src_file)
shell_cmd("/bin/cp '#{src_dir}/#{src_file}' '#{dest_dir}/#{dest_file}'")
end

def copy_storage_inst_subdir
return if dest_dir == "/"
shell_cmd("/bin/rm -rf '#{dest_dir}/#{STORAGE_DUMP_DIR}'")
shell_cmd("/bin/cp -r '#{src_dir}/#{STORAGE_DUMP_DIR}' '#{dest_dir}/#{STORAGE_DUMP_DIR}'")
end

def src_dir
Yast::Directory.logdir
end

log.info "copy log with '#{command}'"
def dest_dir
File.join(Yast::Installation.destdir, Yast::Directory.logdir)
end

Yast::WFM.Execute(LOCAL_BASH, command)
def shell_cmd(cmd)
log.info("Executing #{cmd}")
Yast::WFM.Execute(LOCAL_BASH, cmd)
end
end
end
3 changes: 2 additions & 1 deletion src/lib/installation/widgets/system_roles_radio_buttons.rb
Expand Up @@ -52,7 +52,8 @@ def store
CustomPatterns.show = value == "custom"
store_orig

Yast::Packages.Reset([])
# keep the selected products
Yast::Packages.Reset([:product])
if value == "custom"
# for custom role do not use any desktop
Yast::DefaultDesktop.SetDesktop(nil)
Expand Down
19 changes: 15 additions & 4 deletions test/copy_logs_finish_test.rb
Expand Up @@ -8,6 +8,8 @@
describe "#write" do
before do
allow(Yast::WFM).to receive(:Execute)
# Set the target dir to /mnt
allow(Yast::WFM).to receive(:Args).and_return("initial")
end

def mock_log_dir(files)
Expand All @@ -21,15 +23,15 @@ def expect_to_run(cmd)
it "copies logs from instalation to target system" do
mock_log_dir(["y2start.log"])

expect_to_run(/cp .*y2start.log .*y2start.log/)
expect_to_run(/cp .*y2start.log.*y2start.log/)

subject.write
end

it "rotates y2log" do
mock_log_dir(["y2log-1.gz"])

expect_to_run(/cp .*y2log-1.gz .*y2log-2.gz/)
expect_to_run(/cp .*y2log-1.gz.*y2log-2.gz/)

subject.write
end
Expand All @@ -42,7 +44,7 @@ def expect_to_run(cmd)
subject.write
end

it "does not stuck during compress if file already exists (bnc#897091)" do
it "does not get stuck during compress if file already exists (bnc#897091)" do
mock_log_dir(["y2log-1"])

expect_to_run(/gzip -f/)
Expand All @@ -53,7 +55,16 @@ def expect_to_run(cmd)
it "rotates zypp.log" do
mock_log_dir(["zypp.log"])

expect_to_run(/cp .*zypp.log .*zypp.log-1/)
expect_to_run(/cp .*zypp.log.*zypp.log-1/)

subject.write
end

it "copies the storage-inst subdir" do
mock_log_dir(["storage-inst"])

expect_to_run(/rm -rf .*storage-inst/)
expect_to_run(/cp -r .*storage-inst/)

subject.write
end
Expand Down
1 change: 1 addition & 0 deletions test/lib/clients/inst_system_analysis_test.rb
Expand Up @@ -47,6 +47,7 @@

it "uses default activation callbacks" do
expect(storage).to receive(:activate).with(nil).and_return true
expect(Yast::Execute).to receive(:locally!).with("/sbin/udevadm", "control", "--property=ANACONDA=yes")
client.ActionHDDProbe
end

Expand Down

0 comments on commit 0594565

Please sign in to comment.