From 5f950ea21152e21f797584e34beb9ad53dc1e890 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 14:24:15 +0200
Subject: [PATCH 01/14] kdump and systemd-boot does not work together
---
src/modules/Kdump.rb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 31aee3a..bab16cc 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -686,8 +686,11 @@ def AddPackages
# @return [Boolean] the default proposed state
def ProposeCrashkernelParam
+ # proposing disabled kdump because it does not work with systemd-boot together
+ if Bootloader.getLoaderType == "systemd-boot"
+ log.info ("kdump disabled because systemd-boot is active."
# proposing disabled kdump if product wants it (bsc#1071242)
- if !ProductFeatures.GetBooleanFeature("globals", "enable_kdump")
+ elsif !ProductFeatures.GetBooleanFeature("globals", "enable_kdump")
log.info "Kdump disabled in control file"
false
# proposing disabled kdump if PC has less than 1024MB RAM
From 1070b11958d36057ccc52fc32b58511572bbb343 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 14:33:55 +0200
Subject: [PATCH 02/14] kdump and systemd-boot does not work together
---
src/modules/Kdump.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index bab16cc..6d6d873 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -689,6 +689,7 @@ def ProposeCrashkernelParam
# proposing disabled kdump because it does not work with systemd-boot together
if Bootloader.getLoaderType == "systemd-boot"
log.info ("kdump disabled because systemd-boot is active."
+ false
# proposing disabled kdump if product wants it (bsc#1071242)
elsif !ProductFeatures.GetBooleanFeature("globals", "enable_kdump")
log.info "Kdump disabled in control file"
From 52f5449efd045c165826958c633f6f6e2e38044e Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 14:36:17 +0200
Subject: [PATCH 03/14] kdump and systemd-boot does not work together
---
src/modules/Kdump.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 6d6d873..3c54128 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -688,7 +688,7 @@ def AddPackages
def ProposeCrashkernelParam
# proposing disabled kdump because it does not work with systemd-boot together
if Bootloader.getLoaderType == "systemd-boot"
- log.info ("kdump disabled because systemd-boot is active."
+ log.info ("kdump disabled because systemd-boot is active.")
false
# proposing disabled kdump if product wants it (bsc#1071242)
elsif !ProductFeatures.GetBooleanFeature("globals", "enable_kdump")
From 283ee46e8c8986006654e501cd495a5ff01a76dc Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 15:57:31 +0200
Subject: [PATCH 04/14] kdump and systemd-boot does not work together
---
src/modules/Kdump.rb | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 3c54128..4119a5a 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -83,9 +83,6 @@ def reset
@proposal_valid = false
- # true if propose was called
- @propose_called = false
-
# Boolean option indicates that "crashkernel" includes
# several values for the same kind of memory (low, high)
# or several ranges in one of the values
@@ -712,14 +709,13 @@ def ProposeCrashkernelParam
def ProposeGlobalVars
# Settings have not been imported by AutoYaST and have not already
- # been suggested by proposal. (bnc#930950, bnc#995750, bnc#890719).
- if !@propose_called && !@import_called
+ # been changed. (bnc#930950, bnc#995750, bnc#890719).
+ if !@modified && !@import_called
# added default settings
@KDUMP_SETTINGS = deep_copy(@DEFAULT_CONFIG)
@add_crashkernel_param = ProposeCrashkernelParam()
@crashkernel_param = false
end
- @propose_called = true
nil
end
@@ -1053,7 +1049,6 @@ def fadump_supported?
publish :function => :SetModified, :type => "void ()"
publish :variable => :modified, :type => "boolean"
publish :variable => :proposal_valid, :type => "boolean"
- publish :variable => :propose_called, :type => "boolean"
publish :function => :total_memory, :type => "integer ()"
publish :variable => :crashkernel_list_ranges, :type => "boolean"
publish :variable => :kdump_packages, :type => "list "
From 2e4355c14e853407992bad1586f609216e8d4b18 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 16:35:42 +0200
Subject: [PATCH 05/14] added warning string
---
src/modules/Kdump.rb | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 4119a5a..77ea787 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -897,23 +897,35 @@ def proposal_warning
return {} if free_space.nil? || requested_space.nil?
warning = {}
+ warning_string = ""
+
+ if free_space < requested_space
+ # TRANSLATORS: warning message in installation proposal. Do not translate %{requested} and
+ # %{available} - they are replaced with actual sizes later.
+ warning_string = _(
+ "Warning! There might not be enough free space to have kdump enabled. " \
+ "%{required} required for saving a kernel dump, but only %{available} are available."
+ ) % {
+ required: String.FormatSizeWithPrecision(requested_space, 2, true),
+ available: String.FormatSizeWithPrecision(free_space, 2, true)
+ }
+ end
+
+ if Bootloader.getLoaderType == "systemd-boot" && @add_crashkernel_param
+ if warning_string.length > 0
+ warning_string += "
"
+ end
+ warning_string += _("Kdump will not be installed correctly if systemd-boot is used.")
+ end
if free_space < requested_space
warning = {
"warning_level" => :warning,
- # TRANSLATORS: warning message in installation proposal. Do not translate %{requested} and
- # %{available} - they are replaced with actual sizes later.
- "warning" => "- " + _(
- "Warning! There might not be enough free space to have kdump enabled. " \
- "%{required} required for saving a kernel dump, but only %{available} are available."
- ) % {
- required: String.FormatSizeWithPrecision(requested_space, 2, true),
- available: String.FormatSizeWithPrecision(free_space, 2, true)
- } + "
"
+ "warning" => ""
}
end
- log.warn warning["warning"] if warning["warning"]
+ log.warn warning["warning"] if warning_string.length > 0
warning
end
From 1865c54c13c487e745e23f34465c1bf1e3ddacc7 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 17:07:25 +0200
Subject: [PATCH 06/14] added warning string
---
src/modules/Kdump.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 77ea787..f350c1a 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -918,14 +918,14 @@ def proposal_warning
warning_string += _("Kdump will not be installed correctly if systemd-boot is used.")
end
- if free_space < requested_space
+ if warning_string.length > 0
warning = {
"warning_level" => :warning,
"warning" => ""
}
end
- log.warn warning["warning"] if warning_string.length > 0
+ log.warn warning["warning"] if warning["warning"]
warning
end
From 50e6fc6110ad87302c00f859ef7dce9378310fb7 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 17:10:28 +0200
Subject: [PATCH 07/14] added warning string
---
src/modules/Kdump.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index f350c1a..a4c322f 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -915,7 +915,7 @@ def proposal_warning
if warning_string.length > 0
warning_string += "
"
end
- warning_string += _("Kdump will not be installed correctly if systemd-boot is used.")
+ warning_string += _("Kdump will not be installed correctly if Systemd Boot is used.")
end
if warning_string.length > 0
From 3471c3c86f258549b6398c8f4903c1574e821d19 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Wed, 19 Jun 2024 17:50:53 +0200
Subject: [PATCH 08/14] updated version
---
package/yast2-kdump.changes | 7 +++++++
package/yast2-kdump.spec | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/package/yast2-kdump.changes b/package/yast2-kdump.changes
index 68da72b..445e2b0 100644
--- a/package/yast2-kdump.changes
+++ b/package/yast2-kdump.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Wed Jun 19 15:36:03 UTC 2024 - Stefan Schubert
+
+- Do not suggest Kdump if Systemd-Boot is used. Kdump is not stable
+ if Systemd-Bootloader is used.
+- 5.0.1
+
-------------------------------------------------------------------
Wed Aug 30 20:16:10 UTC 2023 - Josef Reidinger
diff --git a/package/yast2-kdump.spec b/package/yast2-kdump.spec
index 3252848..17f19c3 100644
--- a/package/yast2-kdump.spec
+++ b/package/yast2-kdump.spec
@@ -17,7 +17,7 @@
Name: yast2-kdump
-Version: 5.0.0
+Version: 5.0.1
Release: 0
Summary: Configuration of kdump
License: GPL-2.0-only
From 11f713692a5a3800765e896c80ea5d30ee3ce9be Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Thu, 20 Jun 2024 11:45:35 +0200
Subject: [PATCH 09/14] fixed testcase
---
test/kdump_test.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test/kdump_test.rb b/test/kdump_test.rb
index f0ec1f9..ef8e498 100755
--- a/test/kdump_test.rb
+++ b/test/kdump_test.rb
@@ -54,6 +54,9 @@
allow(Yast::Arch).to receive(:aarch64).and_return false
allow(Yast::ProductFeatures).to receive(:GetBooleanFeature).with("globals", "enable_kdump")
.and_return(true)
+ allow(Yast::ProductFeatures).to receive(:GetBooleanFeature)
+ .with("globals", "enable_systemd_boot")
+ .and_return(false)
end
context "while running on machine with less than 1024 MB memory" do
From 039ae680d4e65b60014a22db7aa5bc7b2393647c Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Thu, 20 Jun 2024 15:55:46 +0200
Subject: [PATCH 10/14] making rubocop happy
---
.rubocop.yml | 2 +-
Rakefile | 2 +
src/clients/kdump.rb | 2 +
src/clients/kdump_auto.rb | 2 +
src/clients/kdump_finish.rb | 2 +
src/clients/kdump_proposal.rb | 11 +-
src/include/kdump/complex.rb | 7 +-
src/include/kdump/dialogs.rb | 2 +-
src/include/kdump/helps.rb | 124 ++++++------
src/include/kdump/uifunctions.rb | 251 +++++++++++-------------
src/include/kdump/wizards.rb | 2 +-
src/lib/kdump/clients/auto.rb | 3 +-
src/lib/kdump/clients/finish.rb | 3 +-
src/lib/kdump/clients/kdump.rb | 92 ++++-----
src/lib/kdump/kdump_calibrator.rb | 6 +-
src/lib/kdump/kdump_system.rb | 2 +-
src/modules/Kdump.rb | 121 ++++++------
test/auto_test.rb | 1 +
test/fadump_test.rb | 1 +
test/finish_test.rb | 1 +
test/include/uifunctions.rb | 20 +-
test/kdump_test.rb | 9 +-
test/lib/kdump/clients/kdump_test.rb | 2 +
test/lib/kdump/kdump_calibrator_test.rb | 1 +
test/lib/kdump/kdump_system_test.rb | 1 +
test/test_helper.rb | 6 +-
26 files changed, 343 insertions(+), 333 deletions(-)
diff --git a/.rubocop.yml b/.rubocop.yml
index bab5acb..80faa97 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,6 +1,6 @@
# use the shared Yast defaults
inherit_from:
- /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml
+ /usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml
Metrics/AbcSize:
Max: 129
diff --git a/Rakefile b/Rakefile
index 2432dd5..1dfb659 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "yast/rake"
Yast::Tasks.configuration do |conf|
diff --git a/src/clients/kdump.rb b/src/clients/kdump.rb
index 017786a..902458f 100644
--- a/src/clients/kdump.rb
+++ b/src/clients/kdump.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Copyright (c) [2006-2021] SUSE LLC
#
# All Rights Reserved.
diff --git a/src/clients/kdump_auto.rb b/src/clients/kdump_auto.rb
index 9177222..30cb375 100644
--- a/src/clients/kdump_auto.rb
+++ b/src/clients/kdump_auto.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "kdump/clients/auto"
Y2Kdump::Clients::Auto.run
diff --git a/src/clients/kdump_finish.rb b/src/clients/kdump_finish.rb
index d6c7914..fb84734 100644
--- a/src/clients/kdump_finish.rb
+++ b/src/clients/kdump_finish.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
require "kdump/clients/finish"
::Y2Kdump::Clients::Finish.run
diff --git a/src/clients/kdump_proposal.rb b/src/clients/kdump_proposal.rb
index a59dfe9..4cf078d 100644
--- a/src/clients/kdump_proposal.rb
+++ b/src/clients/kdump_proposal.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2008 Novell, Inc. All Rights Reserved.
@@ -39,7 +39,8 @@ def main
@param = Convert.to_map(WFM.Args(1))
@ret = {}
- if @func == "MakeProposal"
+ case @func
+ when "MakeProposal"
Kdump.Propose
@ret = {
@@ -57,7 +58,7 @@ def main
}
@ret.merge!(Kdump.proposal_warning)
- elsif @func == "AskUser"
+ when "AskUser"
@has_next = Ops.get_boolean(@param, "has_next", false)
@settings = Kdump.Export
Kdump.modified = false
@@ -77,7 +78,7 @@ def main
# Kdump::CheckPackages();
# Fill return map
@ret = { "workflow_sequence" => @result }
- elsif @func == "Description"
+ when "Description"
@ret = {
# proposal part - kdump label
"rich_text_title" => _("Kdump"),
@@ -85,7 +86,7 @@ def main
"menu_title" => _("&Kdump"),
"id" => "kdump_stuff"
}
- elsif @func == "Write"
+ when "Write"
# Write is called in finish script (kdump_finish.ycp)
# it is necessary do it after bootloader write his settings
# boolean succ = Kdump::Write ();
diff --git a/src/include/kdump/complex.rb b/src/include/kdump/complex.rb
index 2f3f9d5..d7424c9 100644
--- a/src/include/kdump/complex.rb
+++ b/src/include/kdump/complex.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
@@ -83,9 +83,8 @@ def ReadDialog
Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", ""))
# Kdump::AbortFunction = PollAbort;
return :abort if !Confirm.MustBeRoot
- if !Kdump.system.supports_kdump? && !unsupported_kdump_confirmation
- return :abort
- end
+ return :abort if !Kdump.system.supports_kdump? && !unsupported_kdump_confirmation
+
InstallPackages() or return :abort
ret = Kdump.Read
diff --git a/src/include/kdump/dialogs.rb b/src/include/kdump/dialogs.rb
index 0741c34..b35fa56 100644
--- a/src/include/kdump/dialogs.rb
+++ b/src/include/kdump/dialogs.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
diff --git a/src/include/kdump/helps.rb b/src/include/kdump/helps.rb
index ceff8f9..64de70b 100644
--- a/src/include/kdump/helps.rb
+++ b/src/include/kdump/helps.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
@@ -35,8 +35,8 @@ def initialize_kdump_helps(_include_target)
# Enable/Disable Kdump - RadioButtons 1/1
"StartRadioBut" => _(
"Enable/Disable Kdump
\n" \
- " Enable or disable kdump. The \"crashkernel\" boot parameter is added/removed. \n" \
- " To apply changes, a reboot is necessary.
\n"
+ " Enable or disable kdump. The \"crashkernel\" boot parameter is added/removed. \n" \
+ " To apply changes, a reboot is necessary.
\n"
),
# Kdump Memor&y [MB] - IntField 1/1
"KdumpMemory" => _(
@@ -55,29 +55,29 @@ def initialize_kdump_helps(_include_target)
# T: help text for a combo box
# description taken from http://lparbox.com/how-to/aix/19
"Firmware-Assisted Dump
\n" \
- " Dumps are not generated before the partition is reinitialized but take place " \
- " when the partition is restarting. When performing a firmware-assisted dump, " \
- " system memory is frozen and the partition rebooted, which allows a new instance " \
- " of the operating system to dump data from the previous kernel crash." \
- " This feature is suitable only when the system has more than 1.5 GB of memory.
"
+ " Dumps are not generated before the partition is reinitialized but take place " \
+ " when the partition is restarting. When performing a firmware-assisted dump, " \
+ " system memory is frozen and the partition rebooted, which allows a new instance " \
+ " of the operating system to dump data from the previous kernel crash." \
+ " This feature is suitable only when the system has more than 1.5 GB of memory."
),
# Kdump Memor&y [MB] - IntField 1/1
"DumpLevel" => _(
"Dump Level
\n" \
- " Specify the type of necessary page for analysis.\n" \
- " Pages of the specified type are copied to the dumpfile. \n" \
- " The page type marked in the following table is included.
"
+ " Specify the type of necessary page for analysis.\n" \
+ " Pages of the specified type are copied to the dumpfile. \n" \
+ " The page type marked in the following table is included.
"
),
# Dump Format - RadioButtons 1/1
"DumpFormat" => _(
"Dump Format
\n" \
- " No Dump - Only save the kernel log.
\n" \
- " ELF Format - Create dump file in ELF format.
\n" \
- " Compressed Format - Compress dump data by each page with gzip.
\n" \
- " LZO Compressed Format - Slightly bigger files but much faster.
\n
" \
- " Snappy Compressed Format - Considerably faster, 64-bit optimized.
\n" \
- " Zstandard Compressed Format - Smaller files, slower.
\n" \
- " Raw copy of /proc/vmcore - does not use makedumpfile.
\n"
+ " No Dump - Only save the kernel log.
\n" \
+ " ELF Format - Create dump file in ELF format.
\n" \
+ " Compressed Format - Compress dump data by each page with gzip.
\n" \
+ " LZO Compressed Format - Slightly bigger files but much faster.
\n" \
+ " Snappy Compressed Format - Considerably faster, 64-bit optimized.
\n" \
+ " Zstandard Compressed Format - Smaller files, slower.
\n" \
+ " Raw copy of /proc/vmcore - does not use makedumpfile.
\n"
),
# Dump Format - RadioButtons 1/7
"TargetKdump" => _(
@@ -86,36 +86,36 @@ def initialize_kdump_helps(_include_target)
# Dump Format - RadioButtons 2/7
_(
"Local Filesystem - Save the kdump image in the local filesystem.\n" \
- " Directory for Saving Dumps - The path for saving kdump images.\n" \
- " Selecting directory for saving kdump images via dialog by pressing Browse\n" \
- "
"
+ " Directory for Saving Dumps - The path for saving kdump images.\n" \
+ " Selecting directory for saving kdump images via dialog by pressing Browse\n" \
+ "
"
) +
# Dump Format - RadioButtons 3/7
_(
"FTP - Save kdump image via FTP.\n" \
- " Server Name - The name of the ftp server.\n" \
- " Port - The port number for the connection.\n" \
- " Directory on Server - The path for saving kdump images.\n" \
- " Enable Anonymous FTP enables anonymous connection to the server.\n" \
- " User Name for ftp connection. Password for ftp connection.
"
+ " Server Name - The name of the ftp server.\n" \
+ " Port - The port number for the connection.\n" \
+ " Directory on Server - The path for saving kdump images.\n" \
+ " Enable Anonymous FTP enables anonymous connection to the server.\n" \
+ " User Name for ftp connection. Password for ftp connection.
"
) +
# Dump Format - RadioButtons 4/7
_(
"SSH - Save kdump image via SSH and 'dd' on target machine.\n" \
- " Server Name - The name of the server.\n" \
- " Port - The port number for the connection.\n" \
- " Directory on Server - The path for saving kdump images.\n" \
- " User Name for SSH connection. \n" \
- " Password for SSH connection.
\n"
+ " Server Name - The name of the server.\n" \
+ " Port - The port number for the connection.\n" \
+ " Directory on Server - The path for saving kdump images.\n" \
+ " User Name for SSH connection. \n" \
+ " Password for SSH connection.
\n"
) +
# Dump Format - RadioButtons 5/7
_(
"SFTP - Save kdump image via SFTP.\n" \
- " Server Name - The name of the server.\n" \
- " Port - The port number for the connection.\n" \
- " Directory on Server - The path for saving kdump images.\n" \
- " User Name for SSH connection. \n" \
- " Password for SSH connection.
\n"
+ " Server Name - The name of the server.\n" \
+ " Port - The port number for the connection.\n" \
+ " Directory on Server - The path for saving kdump images.\n" \
+ " User Name for SSH connection. \n" \
+ " Password for SSH connection.
\n"
) +
_(
"The choice between SSH and SFTP depends\n" \
@@ -125,23 +125,23 @@ def initialize_kdump_helps(_include_target)
# Dump Format - RadioButtons 6/7
_(
"
NFS - Save kdump image on NFS.\n" \
- " Server Name - The name of the nfs server.\n" \
- " Directory on Server - The path for saving kdump images.
"
+ " Server Name - The name of the nfs server.\n" \
+ " Directory on Server - The path for saving kdump images.
"
) +
# Dump Format - RadioButtons 7/7
_(
"CIFS - Save kdump image via CIFS.\n" \
- " Server Name - The name of the server.\n" \
- " Exported Share - The windows share name.\n" \
- " Directory on Server - The path for saving kdump images.\n" \
- " Use Authentication enables authenticated connection to the server.\n" \
- " User Name for the connection. Password for the connection.
"
+ " Server Name - The name of the server.\n" \
+ " Exported Share - The windows share name.\n" \
+ " Directory on Server - The path for saving kdump images.\n" \
+ " Use Authentication enables authenticated connection to the server.\n" \
+ " User Name for the connection. Password for the connection.
"
),
# Custom Kdump Kernel - TextEntry 1/1
"InitrdKernel" => _(
"Custom Kdump Kernel The user can enter the custom kernel.\n" \
- " The naming scheme is:/boot/vmlinu[zx]-[.gz]\n" \
- " Please enter only kernel_string.
"
+ " The naming scheme is:/boot/vmlinu[zx]-[.gz]\n" \
+ " Please enter only kernel_string.
"
),
# Kdump Command Line - TextEntry 1/1
"KdumpCommandLine" => _(
@@ -150,9 +150,9 @@ def initialize_kdump_helps(_include_target)
# Kdump Command Line Append - TextEntry 1/1
"KdumpCommandLineAppend" => _(
"Kdump Command Line Append\n" \
- " Set this option to _append_ values to the default command line string. \n" \
- " The string will be appended if the Kdump Command Line\n" \
- " is set.
\n"
+ " Set this option to _append_ values to the default command line string. \n" \
+ " The string will be appended if the Kdump Command Line\n" \
+ " is set.
\n"
),
# Enable Immediate Reboot After Saving the Core - CheckBox 1/1
"EnableReboot" => _(
@@ -161,8 +161,8 @@ def initialize_kdump_helps(_include_target)
# Enable Delete Old Dump Images - CheckBox 1/1
"EnableDeleteImages" => _(
"Enable Delete Old Dump Images - \n" \
- " Enable Delete Old Dump Images. If the number of dump files in \n" \
- " Number of Old Dumps exceeds this number, older dumps are removed.
"
+ " Enable Delete Old Dump Images. If the number of dump files in \n" \
+ " Number of Old Dumps exceeds this number, older dumps are removed.
"
),
# SMTP Server
"SMTPServer" => _(
@@ -203,9 +203,9 @@ def initialize_kdump_helps(_include_target)
# Write dialog help 2/2
_(
"Aborting Saving:
\n" \
- "Abort the save procedure by pressing Abort.\n" \
- "An additional dialog informs whether it is safe to do so.\n" \
- "
\n"
+ "Abort the save procedure by pressing Abort.\n" \
+ "An additional dialog informs whether it is safe to do so.\n" \
+ "\n"
),
# Summary dialog help 1/3
"summary" => _(
@@ -214,21 +214,21 @@ def initialize_kdump_helps(_include_target)
# Summary dialog help 2/3
_(
"Adding a Kdump:
\n" \
- "Choose an kdump from the list of detected kdumps.\n" \
- "If your kdump was not detected, select Other (not detected).\n" \
- "Then press Configure.
\n"
+ "Choose an kdump from the list of detected kdumps.\n" \
+ "If your kdump was not detected, select Other (not detected).\n" \
+ "Then press Configure.\n"
) +
# Summary dialog help 3/3
_(
"Editing or Deleting:
\n" \
- "If you press Edit, an additional dialog in which to change\n" \
- "the configuration opens.
\n"
+ "If you press Edit, an additional dialog in which to change\n" \
+ "the configuration opens.\n"
),
# Ovreview dialog help 1/3
"overview" => _(
"Kdump Configuration Overview
\n" \
- "Obtain an overview of installed kdumps. Additionally\n" \
- "edit their configurations.
\n"
+ "Obtain an overview of installed kdumps. Additionally\n" \
+ "edit their configurations.
\n"
) +
# Ovreview dialog help 2/3
_(
@@ -237,8 +237,8 @@ def initialize_kdump_helps(_include_target)
# Ovreview dialog help 3/3
_(
"Editing or Deleting:
\n" \
- "Choose a kdump to change or remove.\n" \
- "Then press Edit or Delete as desired.
\n"
+ "Choose a kdump to change or remove.\n" \
+ "Then press Edit or Delete as desired.\n"
)
}
end
diff --git a/src/include/kdump/uifunctions.rb b/src/include/kdump/uifunctions.rb
index b5aaf44..34f9ecb 100644
--- a/src/include/kdump/uifunctions.rb
+++ b/src/include/kdump/uifunctions.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
@@ -239,11 +239,7 @@ def StoreEnableDisalbeKdump(_key, _event)
radiobut = Convert.to_string(
UI.QueryWidget(Id("EnableDisalbeKdump"), :Value)
)
- Kdump.add_crashkernel_param = if radiobut == "enable_kdump"
- true
- else
- false
- end
+ Kdump.add_crashkernel_param = radiobut == "enable_kdump"
nil
end
@@ -296,22 +292,22 @@ def SetUpKDUMP_SAVE_TARGET(target)
user_pas = Builtins.substring(parse_target, 0, pos)
pos1 = Builtins.search(user_pas, ":")
- if !pos1.nil?
+ if pos1.nil?
Ops.set(
@KDUMP_SAVE_TARGET,
"user_name",
- Builtins.substring(user_pas, 0, pos1)
+ Builtins.substring(user_pas, 0, pos)
)
+ else
Ops.set(
@KDUMP_SAVE_TARGET,
- "password",
- Builtins.substring(user_pas, Ops.add(pos1, 1), pos)
+ "user_name",
+ Builtins.substring(user_pas, 0, pos1)
)
- else
Ops.set(
@KDUMP_SAVE_TARGET,
- "user_name",
- Builtins.substring(user_pas, 0, pos)
+ "password",
+ Builtins.substring(user_pas, Ops.add(pos1, 1), pos)
)
end
parse_target = Builtins.substring(parse_target, Ops.add(pos, 1))
@@ -321,7 +317,13 @@ def SetUpKDUMP_SAVE_TARGET(target)
pos1 = Builtins.search(parse_target, ":")
pos = Builtins.search(parse_target, "/")
- if !pos1.nil?
+ if pos1.nil?
+ Ops.set(
+ @KDUMP_SAVE_TARGET,
+ "server",
+ Builtins.substring(parse_target, 0, pos)
+ )
+ else
Ops.set(
@KDUMP_SAVE_TARGET,
"server",
@@ -336,12 +338,6 @@ def SetUpKDUMP_SAVE_TARGET(target)
Ops.subtract(pos, Ops.add(pos1, 1))
)
)
- else
- Ops.set(
- @KDUMP_SAVE_TARGET,
- "server",
- Builtins.substring(parse_target, 0, pos)
- )
end
# only cifs
else
@@ -417,13 +413,13 @@ def tostringKDUMP_SAVE_TARGET
end
# add port if it is set...
- if Ops.get(@KDUMP_SAVE_TARGET, "port") != ""
- result = Ops.add(
+ result = if Ops.get(@KDUMP_SAVE_TARGET, "port") == ""
+ Ops.add(result, Ops.get(@KDUMP_SAVE_TARGET, "dir"))
+ else
+ Ops.add(
Ops.add(Ops.add(result, ":"), Ops.get(@KDUMP_SAVE_TARGET, "port")),
Ops.get(@KDUMP_SAVE_TARGET, "dir")
)
- else
- result = Ops.add(result, Ops.get(@KDUMP_SAVE_TARGET, "dir"))
end
# ssh
elsif ["ssh", "sftp"].include?(@KDUMP_SAVE_TARGET["target"])
@@ -448,13 +444,13 @@ def tostringKDUMP_SAVE_TARGET
end
result = Ops.add(result, Ops.get(@KDUMP_SAVE_TARGET, "server"))
# add port if it is set...
- if Ops.get(@KDUMP_SAVE_TARGET, "port") != ""
- result = Ops.add(
+ result = if Ops.get(@KDUMP_SAVE_TARGET, "port") == ""
+ Ops.add(result, Ops.get(@KDUMP_SAVE_TARGET, "dir"))
+ else
+ Ops.add(
Ops.add(Ops.add(result, ":"), Ops.get(@KDUMP_SAVE_TARGET, "port")),
Ops.get(@KDUMP_SAVE_TARGET, "dir")
)
- else
- result = Ops.add(result, Ops.get(@KDUMP_SAVE_TARGET, "dir"))
end
# nfs
@@ -720,9 +716,9 @@ def ValidTargetKdump(_key, _event)
Popup.Error(_("You need to specify \"User Name\""))
UI.SetFocus(Id("user_name"))
return false
- end # end of if ((value == nil) || (value == ""))
- end # end of if (anon)
- end # end of } else if (radiobut == "cifs")
+ end
+ end
+ end
true
end
@@ -742,12 +738,12 @@ def HandleTargetKdump(_key, event)
value = Convert.to_boolean(UI.QueryWidget(Id("anonymous"), :Value))
target = Builtins.tostring(UI.QueryWidget(Id("TargetKdump"), :Value))
- if value && target == "ftp" || !value && target == "cifs"
+ if (value && target == "ftp") || (!value && target == "cifs")
UI.ChangeWidget(Id("user_name"), :Enabled, false)
UI.ChangeWidget(Id("password"), :Enabled, false)
# KDUMP_SAVE_TARGET["user_name"]="";
# KDUMP_SAVE_TARGET["password"]="";
- elsif value && target == "cifs" || !value && target == "ftp"
+ elsif (value && target == "cifs") || (!value && target == "ftp")
UI.ChangeWidget(Id("user_name"), :Enabled, true)
UI.ChangeWidget(Id("password"), :Enabled, true)
end
@@ -848,50 +844,48 @@ def StoreTargetKdumpHandle(type)
# directory
value = Builtins.tostring(UI.QueryWidget(Id("dir"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "dir", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
end
elsif radiobut == "ftp"
Ops.set(@KDUMP_SAVE_TARGET, "target", "ftp")
# server
value = Builtins.tostring(UI.QueryWidget(Id("server"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "server", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "server", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "server", value)
end
# port
- if Builtins.tostring(UI.QueryWidget(Id("port"), :Value)) != "21"
+ if Builtins.tostring(UI.QueryWidget(Id("port"), :Value)) == "21"
+ Ops.set(@KDUMP_SAVE_TARGET, "port", "")
+ else
Ops.set(
@KDUMP_SAVE_TARGET,
"port",
Builtins.tostring(UI.QueryWidget(Id("port"), :Value))
)
- else
- Ops.set(@KDUMP_SAVE_TARGET, "port", "")
end
# directory
value = Builtins.tostring(UI.QueryWidget(Id("dir"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "dir", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
end
# user_name vs. anonymous
value = Builtins.tostring(UI.QueryWidget(Id("user_name"), :Value))
- if Convert.to_boolean(UI.QueryWidget(Id("anonymous"), :Value))
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "user_name", "")
- elsif !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "user_name", value)
else
- Ops.set(@KDUMP_SAVE_TARGET, "user_name", "")
+ Ops.set(@KDUMP_SAVE_TARGET, "user_name", value)
end
# password
@@ -919,39 +913,39 @@ def StoreTargetKdumpHandle(type)
# server
value = Builtins.tostring(UI.QueryWidget(Id("server"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "server", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "server", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "server", value)
end
# port
- if Builtins.tostring(UI.QueryWidget(Id("port"), :Value)) != "22"
+ if Builtins.tostring(UI.QueryWidget(Id("port"), :Value)) == "22"
+ Ops.set(@KDUMP_SAVE_TARGET, "port", "")
+ else
Ops.set(
@KDUMP_SAVE_TARGET,
"port",
Builtins.tostring(UI.QueryWidget(Id("port"), :Value))
)
- else
- Ops.set(@KDUMP_SAVE_TARGET, "port", "")
end
# directory
value = Builtins.tostring(UI.QueryWidget(Id("dir"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "dir", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
end
# user_name
value = Builtins.tostring(UI.QueryWidget(Id("user_name"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "user_name", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "user_name", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "user_name", value)
end
# password
@@ -968,19 +962,19 @@ def StoreTargetKdumpHandle(type)
# server
value = Builtins.tostring(UI.QueryWidget(Id("server"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "server", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "server", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "server", value)
end
# directory
value = Builtins.tostring(UI.QueryWidget(Id("dir"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "dir", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
end
elsif radiobut == "cifs"
Ops.set(@KDUMP_SAVE_TARGET, "target", "cifs")
@@ -988,39 +982,37 @@ def StoreTargetKdumpHandle(type)
# server
value = Builtins.tostring(UI.QueryWidget(Id("server"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "server", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "server", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "server", value)
end
# share
value = Builtins.tostring(UI.QueryWidget(Id("share"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "share", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "share", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "share", value)
end
# directory
value = Builtins.tostring(UI.QueryWidget(Id("dir"), :Value))
- if !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
- else
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "dir", "")
+ else
+ Ops.set(@KDUMP_SAVE_TARGET, "dir", value)
end
# user_name vs. anonymous
value = Builtins.tostring(UI.QueryWidget(Id("user_name"), :Value))
- if !Convert.to_boolean(UI.QueryWidget(Id("anonymous"), :Value))
+ if value.nil?
Ops.set(@KDUMP_SAVE_TARGET, "user_name", "")
- elsif !value.nil?
- Ops.set(@KDUMP_SAVE_TARGET, "user_name", value)
else
- Ops.set(@KDUMP_SAVE_TARGET, "user_name", "")
+ Ops.set(@KDUMP_SAVE_TARGET, "user_name", value)
end
# password
@@ -1154,7 +1146,7 @@ def SetDumpLevel(bit_number)
) do |key|
counter = Ops.add(counter, 1)
one_bit = Builtins.substring(bit_number, counter, 1)
- UI.ChangeWidget(Id(key), :Value, one_bit == "1" ? false : true)
+ UI.ChangeWidget(Id(key), :Value, one_bit != "1")
end
nil
@@ -1215,9 +1207,7 @@ def ValidDumpLevel(_key, _event)
while Ops.less_than(counter, 5)
counter = Ops.add(counter, 1)
one_bit = Builtins.substring(value, counter, 1)
- if one_bit == "1"
- dumplevel = Ops.add(dumplevel, Ops.get(@bit_weight_row, counter, 0))
- end
+ dumplevel = Ops.add(dumplevel, Ops.get(@bit_weight_row, counter, 0)) if one_bit == "1"
end
if Ops.greater_than(dumplevel, 0) || dumplevel.nil?
@@ -1235,25 +1225,25 @@ def ValidDumpLevel(_key, _event)
package_list = []
package_list = Builtins.add(package_list, "makedumpfile")
- if !Package.CheckAndInstallPackages(package_list)
+ if Package.CheckAndInstallPackages(package_list)
+ result = true
+ else
result = false
- if !Mode.commandline
- Popup.Error(Message.CannotContinueWithoutPackagesInstalled)
- else
+ if Mode.commandline
CommandLine.Error(
Message.CannotContinueWithoutPackagesInstalled
)
+ else
+ Popup.Error(Message.CannotContinueWithoutPackagesInstalled)
end
Builtins.y2error(
"[kdump] (ValidDumpLevel) Installation of package list %1 failed or aborted",
package_list
)
- else
- result = true
end
end
- end # end of if ((dumplevel >0 ) || (dumplevel == nil))
+ end
result
end
@@ -1266,9 +1256,7 @@ def StoreDumpLevel(_key, _event)
while Ops.less_than(counter, 5)
counter = Ops.add(counter, 1)
one_bit = Builtins.substring(value, counter, 1)
- if one_bit == "1"
- int_value = Ops.add(int_value, Ops.get(@bit_weight_row, counter, 0))
- end
+ int_value = Ops.add(int_value, Ops.get(@bit_weight_row, counter, 0)) if one_bit == "1"
end
ret = Builtins.tostring(int_value)
@@ -1290,9 +1278,7 @@ def HandleDumpLevel(_key, event)
value_cache_page = Convert.to_boolean(
UI.QueryWidget(Id("cache_page"), :Value)
)
- if value_cache_private && !value_cache_page
- UI.ChangeWidget(Id("cache_page"), :Value, true)
- end
+ UI.ChangeWidget(Id("cache_page"), :Value, true) if value_cache_private && !value_cache_page
end
if ret == "cache_page"
@@ -1435,21 +1421,21 @@ def StoreKdumpMemory(_key, _event)
# Initializes FADump settings in UI
def InitFADump(_key)
- if Kdump.fadump_supported? && UI.WidgetExists(Id("FADump"))
- UI.ReplaceWidget(
- Id("FADump"),
- VBox(
- CheckBox(
- Id("use_fadump"),
- Opt(:notify),
- # T: Checkbox label
- _("Use &Firmware-Assisted Dump"),
- Kdump.using_fadump?
- ),
- VSpacing(1)
- )
+ return unless Kdump.fadump_supported? && UI.WidgetExists(Id("FADump"))
+
+ UI.ReplaceWidget(
+ Id("FADump"),
+ VBox(
+ CheckBox(
+ Id("use_fadump"),
+ Opt(:notify),
+ # T: Checkbox label
+ _("Use &Firmware-Assisted Dump"),
+ Kdump.using_fadump?
+ ),
+ VSpacing(1)
)
- end
+ )
end
def HandleFADump(_key, event)
@@ -1552,25 +1538,25 @@ def ValidDumpFormat(_key, _event)
package_list = []
package_list = Builtins.add(package_list, "makedumpfile")
- if !Package.CheckAndInstallPackages(package_list)
+ if Package.CheckAndInstallPackages(package_list)
+ result = true
+ else
result = false
- if !Mode.commandline
- Popup.Error(Message.CannotContinueWithoutPackagesInstalled)
- else
+ if Mode.commandline
CommandLine.Error(
Message.CannotContinueWithoutPackagesInstalled
)
+ else
+ Popup.Error(Message.CannotContinueWithoutPackagesInstalled)
end
Builtins.y2error(
"[kdump] (ValidDumpFormat) Installation of package list %1 failed or aborted",
package_list
)
- else
- result = true
end
end
- end # end of if ((value != "elf_format") || (value == nil))
+ end
result
end
@@ -1579,17 +1565,18 @@ def ValidDumpFormat(_key, _event)
def StoreDumpFormat(_key, _event)
value = Builtins.tostring(UI.QueryWidget(Id("DumpFormat"), :Value))
- if value == "elf_format"
+ case value
+ when "elf_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "ELF")
- elsif value == "compressed_format"
+ when "compressed_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "compressed")
- elsif value == "lzo_format"
+ when "lzo_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "lzo")
- elsif value == "snappy_format"
+ when "snappy_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "snappy")
- elsif value == "zstd_format"
+ when "zstd_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "zstd")
- elsif value == "raw_format"
+ when "raw_format"
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "raw")
else
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_DUMPFORMAT", "none")
@@ -1603,12 +1590,12 @@ def StoreDumpFormat(_key, _event)
def InitEnableDeleteImages(_key)
UI.ChangeWidget(Id("EnableDeleteImages"), :Notify, true)
- if Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_KEEP_OLD_DUMPS") != "0"
- UI.ChangeWidget(Id("NumberDumps"), :Enabled, true)
- UI.ChangeWidget(Id("EnableDeleteImages"), :Value, true)
- else
+ if Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_KEEP_OLD_DUMPS") == "0"
UI.ChangeWidget(Id("EnableDeleteImages"), :Value, false)
UI.ChangeWidget(Id("NumberDumps"), :Enabled, false)
+ else
+ UI.ChangeWidget(Id("NumberDumps"), :Enabled, true)
+ UI.ChangeWidget(Id("EnableDeleteImages"), :Value, true)
end
nil
@@ -1623,10 +1610,7 @@ def HandleEnableDeleteImages(_key, event)
value = Convert.to_boolean(
UI.QueryWidget(Id("EnableDeleteImages"), :Value)
)
- if !value
- UI.ChangeWidget(Id("NumberDumps"), :Value, Builtins.tointeger("0"))
- UI.ChangeWidget(Id("NumberDumps"), :Enabled, false)
- else
+ if value
UI.ChangeWidget(
Id("NumberDumps"),
:Value,
@@ -1635,6 +1619,9 @@ def HandleEnableDeleteImages(_key, event)
)
)
UI.ChangeWidget(Id("NumberDumps"), :Enabled, true)
+ else
+ UI.ChangeWidget(Id("NumberDumps"), :Value, Builtins.tointeger("0"))
+ UI.ChangeWidget(Id("NumberDumps"), :Enabled, false)
end
end
diff --git a/src/include/kdump/wizards.rb b/src/include/kdump/wizards.rb
index 399c0ba..b83610e 100644
--- a/src/include/kdump/wizards.rb
+++ b/src/include/kdump/wizards.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
diff --git a/src/lib/kdump/clients/auto.rb b/src/lib/kdump/clients/auto.rb
index c4bc5f4..620db6f 100644
--- a/src/lib/kdump/clients/auto.rb
+++ b/src/lib/kdump/clients/auto.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2019 SUSE LLC
@@ -28,6 +28,7 @@ def initialize
textdomain "kdump"
Yast.include self, "kdump/wizards.rb" # needed for auto sequence
+ super
end
def import(profile)
diff --git a/src/lib/kdump/clients/finish.rb b/src/lib/kdump/clients/finish.rb
index 851eba8..dc32b85 100644
--- a/src/lib/kdump/clients/finish.rb
+++ b/src/lib/kdump/clients/finish.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2017 SUSE LLC
@@ -25,6 +25,7 @@ def initialize
Yast.import "Kdump"
Yast.import "Mode"
Yast.import "Progress"
+ super
end
def title
diff --git a/src/lib/kdump/clients/kdump.rb b/src/lib/kdump/clients/kdump.rb
index 400428a..46a9e44 100644
--- a/src/lib/kdump/clients/kdump.rb
+++ b/src/lib/kdump/clients/kdump.rb
@@ -16,7 +16,7 @@
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-# encoding: utf-8
+# frozen_string_literal: true
Yast.import "UI"
Yast.import "Progress"
@@ -40,6 +40,7 @@ def initialize
Yast.include self, "kdump/wizards.rb"
Yast.include self, "kdump/uifunctions.rb"
+ super
end
def main
@@ -363,11 +364,9 @@ def main
# is this proposal or not?
@propose = false
@args = WFM.Args
- if Ops.greater_than(Builtins.size(@args), 0)
- if Ops.is_path?(WFM.Args(0)) && WFM.Args(0) == path(".propose")
- Builtins.y2milestone("Using PROPOSE mode")
- @propose = true
- end
+ if Ops.greater_than(Builtins.size(@args), 0) && (Ops.is_path?(WFM.Args(0)) && WFM.Args(0) == path(".propose"))
+ Builtins.y2milestone("Using PROPOSE mode")
+ @propose = true
end
# main ui function
@@ -591,7 +590,7 @@ def cmdKdumpShow(_options)
else
# TRANSLATORS: CommandLine printed text
CommandLine.Print(_("EMPTY"))
- end # end of if (SetUpKDUMP_SAVE_TARGET(Kdump::KDUMP_SETTINGS["KDUMP_SAVEDIR"]:nil))
+ end
if Ops.get(Kdump.KDUMP_SETTINGS, "KDUMP_KERNELVER") != ""
CommandLine.Print("")
@@ -719,7 +718,7 @@ def cmdKdumpShow(_options)
end
# Only numbers are allowed as allow_mem_high and allow_mem_low values
- ALLOC_MEM_REGEXP = /\A\d+\z/
+ ALLOC_MEM_REGEXP = /\A\d+\z/.freeze
def cmdKdumpStartup(options)
options = deep_copy(options)
@@ -745,16 +744,16 @@ def cmdKdumpStartup(options)
Kdump.crashkernel_list_ranges = false
end
CommandLine.Print(_("To apply changes a reboot is necessary."))
- return true
+ true
elsif Ops.get(options, "disable")
Kdump.add_crashkernel_param = false
# TRANSLATORS: CommandLine printed text
CommandLine.Print(_("To apply changes a reboot is necessary."))
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -770,16 +769,16 @@ def cmdKdumpDumpLevel(options)
)
# TRANSLATORS: CommandLine printed text
CommandLine.Print(_("Dump level was set."))
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value of option."))
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -794,7 +793,7 @@ def cmdKdumpDumpFormat(options)
)
# TRANSLATORS: CommandLine printed text
CommandLine.Print(_("Dump format was set."))
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value of option."))
@@ -802,12 +801,12 @@ def cmdKdumpDumpFormat(options)
CommandLine.Print(
_("Option can include only \"none\", \"ELF\", \"compressed\", \"lzo\", \"snappy\", \"zstd\" or \"raw\" value.")
)
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -892,6 +891,7 @@ def cmdKdumpDumpTarget(options)
Builtins.tostring(Ops.get(options, "pass"))
)
return false if password.nil? || password == ""
+
Ops.set(@KDUMP_SAVE_TARGET, "password", password)
end
when "ssh", "sftp"
@@ -1021,6 +1021,7 @@ def cmdKdumpDumpTarget(options)
Builtins.tostring(Ops.get(options, "pass"))
)
return false if password.nil? || password == ""
+
Ops.set(@KDUMP_SAVE_TARGET, "password", password)
end
else
@@ -1033,11 +1034,11 @@ def cmdKdumpDumpTarget(options)
"KDUMP_SAVEDIR",
tostringKDUMP_SAVE_TARGET
)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1049,11 +1050,11 @@ def cmdKdumpCustomKernel(options)
"KDUMP_KERNELVER",
Builtins.tostring(Ops.get(options, "kernel"))
)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1065,11 +1066,11 @@ def cmdKdumpKernelCommandLine(options)
"KDUMP_COMMANDLINE",
Builtins.tostring(Ops.get(options, "command"))
)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1081,11 +1082,11 @@ def cmdKdumpKernelCommandLineAppend(options)
"KDUMP_COMMANDLINE_APPEND",
Builtins.tostring(Ops.get(options, "command"))
)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1093,14 +1094,14 @@ def cmdKdumpImmediateReboot(options)
options = deep_copy(options)
if Ops.get(options, "enable")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT", "true")
- return true
+ true
elsif Ops.get(options, "disable")
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_IMMEDIATE_REBOOT", "false")
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1113,16 +1114,16 @@ def cmdKdumpKeepOldDumps(options)
"KDUMP_KEEP_OLD_DUMPS",
Builtins.tostring(Ops.get(options, "no"))
)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value of options \"no\"."))
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1133,16 +1134,16 @@ def cmdKdumpSMTPServer(options)
if server != "" && !server.nil?
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_SMTP_SERVER", server)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value for option \"server\"."))
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1153,16 +1154,16 @@ def cmdKdumpSMTPUser(options)
if user != "" && !user.nil?
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_SMTP_USER", user)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value for option \"user\"."))
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1171,6 +1172,7 @@ def cmdKdumpSMTPPass(options)
if Ops.get(options, "pass")
password = cmdParsePassPath(Builtins.tostring(Ops.get(options, "pass")))
return false if password.to_s.empty?
+
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_SMTP_PASSWORD", password)
else
# TRANSLATORS: CommandLine error message
@@ -1188,16 +1190,16 @@ def cmdKdumpSMTPNotifTo(options)
if email != "" && !email.nil?
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_NOTIFICATION_TO", email)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value for option \"email\"."))
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
@@ -1208,29 +1210,29 @@ def cmdKdumpSMTPNotifCC(options)
if email != "" && !email.nil?
Ops.set(Kdump.KDUMP_SETTINGS, "KDUMP_NOTIFICATION_CC", email)
- return true
+ true
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong value for option \"email\"."))
- return false
+ false
end
else
# TRANSLATORS: CommandLine error message
CommandLine.Error(_("Wrong options were used."))
- return false
+ false
end
end
def show_fadump_status
CommandLine.Print(
- _("Firmware-assisted dump: %{status}") %
- { status: Kdump.using_fadump? ? _("Enabled") : _("Disabled") }
+ format(_("Firmware-assisted dump: %{status}"), status: Kdump.using_fadump? ? _("Enabled") : _("Disabled"))
)
end
def cmd_handle_fadump(options)
return Kdump.use_fadump(true) if options["enable"]
return Kdump.use_fadump(false) if options["disable"]
+
if options["status"]
show_fadump_status
return true
diff --git a/src/lib/kdump/kdump_calibrator.rb b/src/lib/kdump/kdump_calibrator.rb
index 6d149f4..36860f5 100644
--- a/src/lib/kdump/kdump_calibrator.rb
+++ b/src/lib/kdump/kdump_calibrator.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "yast"
require "kdump/kdump_system"
@@ -11,8 +13,8 @@ module Yast
class KdumpCalibrator
include Yast::Logger
- KDUMPTOOL_CMD = "/usr/sbin/kdumptool %s calibrate".freeze
- KDUMPTOOL_ARG = "--configfile '%s'".freeze
+ KDUMPTOOL_CMD = "/usr/sbin/kdumptool %s calibrate"
+ KDUMPTOOL_ARG = "--configfile '%s'"
KEYS_MAP = {
"Low" => :default_low,
"MinLow" => :min_low,
diff --git a/src/lib/kdump/kdump_system.rb b/src/lib/kdump/kdump_system.rb
index 80a47c0..5ba8654 100644
--- a/src/lib/kdump/kdump_system.rb
+++ b/src/lib/kdump/kdump_system.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) [2018] SUSE LLC
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index a4c322f..ac3a3d6 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# frozen_string_literal: true
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
@@ -38,15 +38,15 @@ module Yast
class KdumpClass < Module
include Yast::Logger
- FADUMP_KEY = "KDUMP_FADUMP".freeze
- KDUMP_SERVICE_NAME = "kdump".freeze
+ FADUMP_KEY = "KDUMP_FADUMP"
+ KDUMP_SERVICE_NAME = "kdump"
KDUMP_PACKAGES = ["kexec-tools", "kdump"].freeze
- TEMPORARY_CONFIG_FILE = "/var/lib/YaST2/kdump.sysconfig".freeze
+ TEMPORARY_CONFIG_FILE = "/var/lib/YaST2/kdump.sysconfig"
TEMPORARY_CONFIG_PATH = Path.new(".temporary.sysconfig.kdump")
# Space on disk reserved for dump additionally to memory size in bytes
# @see FATE #317488
- RESERVED_DISK_SPACE_BUFFER_B = 4 * 1024**3
+ RESERVED_DISK_SPACE_BUFFER_B = 4 * (1024**3)
def main
textdomain "kdump"
@@ -183,6 +183,7 @@ def reset
# @return [Boolean] return true if abort
def Abort
return @AbortFunction.call == true if !@AbortFunction.nil?
+
false
end
@@ -246,16 +247,13 @@ def checkPassword
return false
end
- if !Ops.get(@KDUMP_SETTINGS, "KDUMP_SAVEDIR", "").include?("@")
- return false
- end
+ return false if !Ops.get(@KDUMP_SETTINGS, "KDUMP_SAVEDIR", "").include?("@")
temp = Builtins.splitstring(
Ops.get(@KDUMP_SETTINGS, "KDUMP_SAVEDIR", ""),
"@"
)
- temp_1 = Ops.get(temp, 0, "")
- position = Builtins.findlastof(temp_1, ":")
+ position = Builtins.findlastof(Ops.get(temp, 0, ""), ":")
return false if position.nil?
# if there is 2 times ":" -> it means that password is defined
@@ -284,7 +282,7 @@ def ReadKdumpKernelParam
@add_crashkernel_param = true
end
- if result == :missing || result == :present
+ if [:missing, :present].include?(result)
@crashkernel_param_values = result
else
# Let's make sure it's an array
@@ -295,12 +293,12 @@ def ReadKdumpKernelParam
@allocated_memory = get_allocated_memory(@crashkernel_param_values)
end
- if xen_result == :missing || xen_result == :present
- @crashkernel_xen_param_values = xen_result
+ @crashkernel_xen_param_values = if [:missing, :present].include?(xen_result)
+ xen_result
else
# Let's make sure it's an array
# filtering nils and empty entries bnc#991140
- @crashkernel_xen_param_values = Array(xen_result).compact.reject(&:empty?)
+ Array(xen_result).compact.reject(&:empty?)
end
true
@@ -324,6 +322,7 @@ def write_temporary_config_file
# @return [Yast::KdumpCalibrator] Calibrator instance
def calibrator
return @calibrator unless @calibrator.nil?
+
if Mode.normal
@calibrator = Yast::KdumpCalibrator.new
else
@@ -403,9 +402,9 @@ def update_initrd
# rebuild initrd. In the end tu script below is used, but needs sauce
# around
if Package.IsTransactionalSystem
- return update_initrd_with("transactional-update --continue kdump")
+ update_initrd_with("transactional-update --continue kdump")
else
- return update_initrd_with("mkdumprd")
+ update_initrd_with("mkdumprd")
end
end
@@ -420,10 +419,10 @@ def update_initrd_with(update_command)
if ret != 0
y2error("Error updating initrd, see #{update_logfile} or call #{update_command} manually")
- Report.Error(_(
+ Report.Error(format(_(
"Error updating initrd while calling '%{cmd}'.\n" \
"See %{log} for details."
- ) % { :cmd => update_command, :log => update_logfile })
+ ), :cmd => update_command, :log => update_logfile))
return false
end
@@ -567,32 +566,33 @@ def Read
# read database
return false if Abort()
+
Progress.NextStage
# Error message
- if !ReadKdumpSettings()
- Report.Error(_("Cannot read config file /etc/sysconfig/kdump"))
- end
+ Report.Error(_("Cannot read config file /etc/sysconfig/kdump")) if !ReadKdumpSettings()
# read another database
return false if Abort()
+
Progress.NextStep
# Error message
- if !ReadKdumpKernelParam()
- Report.Error(_("Cannot read kernel boot options."))
- end
+ Report.Error(_("Cannot read kernel boot options.")) if !ReadKdumpKernelParam()
# read another database
return false if Abort()
+
Progress.NextStep
ProposeAllocatedMemory()
# Error message
Report.Error(_("Cannot read available memory.")) if total_memory.zero?
return false if Abort()
+
# Progress finished
Progress.NextStage
return false if Abort()
+
@modified = false
true
end
@@ -646,6 +646,7 @@ def Write
# write settings
return false if Abort()
+
Progress.NextStage
# Error message
if !WriteKdumpSettings()
@@ -655,6 +656,7 @@ def Write
# write/delete bootloader options for kernel - "crashkernel" and "fadump"
return false if Abort()
+
Progress.NextStage
# Error message
if !WriteKdumpBootParameter()
@@ -662,10 +664,12 @@ def Write
end
return false if Abort()
+
# Progress finished
Progress.NextStage
return false if Abort()
+
true
end
@@ -685,7 +689,7 @@ def AddPackages
def ProposeCrashkernelParam
# proposing disabled kdump because it does not work with systemd-boot together
if Bootloader.getLoaderType == "systemd-boot"
- log.info ("kdump disabled because systemd-boot is active.")
+ log.info("kdump disabled because systemd-boot is active.")
false
# proposing disabled kdump if product wants it (bsc#1071242)
elsif !ProductFeatures.GetBooleanFeature("globals", "enable_kdump")
@@ -726,31 +730,31 @@ def ProposeGlobalVars
def CheckPackages
# remove duplicates
@kdump_packages.uniq!
- if !@add_crashkernel_param
+ if @add_crashkernel_param
Builtins.y2milestone(
- "deselect packages for installation: %1",
+ "select packages for installation: %1",
@kdump_packages
)
@kdump_packages.each do |p|
- PackagesProposal.RemoveResolvables("yast2-kdump", :package, [p])
+ PackagesProposal.AddResolvables("yast2-kdump", :package, [p])
end
if !@kdump_packages.empty?
Builtins.y2milestone(
- "Deselected kdump packages for installation: %1",
+ "Selected kdump packages for installation: %1",
@kdump_packages
)
end
else
Builtins.y2milestone(
- "select packages for installation: %1",
+ "deselect packages for installation: %1",
@kdump_packages
)
@kdump_packages.each do |p|
- PackagesProposal.AddResolvables("yast2-kdump", :package, [p])
+ PackagesProposal.RemoveResolvables("yast2-kdump", :package, [p])
end
if !@kdump_packages.empty?
Builtins.y2milestone(
- "Selected kdump packages for installation: %1",
+ "Deselected kdump packages for installation: %1",
@kdump_packages
)
end
@@ -860,7 +864,7 @@ def free_space_for_dump_b
end
# The longest match
- partition = matching_partitions.keys.sort_by { |partiton| partiton.length }.last
+ partition = matching_partitions.keys.max_by { |partiton| partiton.length }
free_space = matching_partitions[partition]
if free_space.nil? || !free_space.is_a?(::Integer)
@@ -880,7 +884,7 @@ def free_space_for_dump_b
# @return [Integer] bytes
def space_requested_for_dump_b
# Total memory is in MB, converting to bytes
- total_memory * 1024**2 + RESERVED_DISK_SPACE_BUFFER_B
+ (total_memory * (1024**2)) + RESERVED_DISK_SPACE_BUFFER_B
end
# Returns installation proposal warning as part of the MakeProposal map result
@@ -902,23 +906,18 @@ def proposal_warning
if free_space < requested_space
# TRANSLATORS: warning message in installation proposal. Do not translate %{requested} and
# %{available} - they are replaced with actual sizes later.
- warning_string = _(
+ warning_string = format(_(
"Warning! There might not be enough free space to have kdump enabled. " \
"%{required} required for saving a kernel dump, but only %{available} are available."
- ) % {
- required: String.FormatSizeWithPrecision(requested_space, 2, true),
- available: String.FormatSizeWithPrecision(free_space, 2, true)
- }
+ ), required: String.FormatSizeWithPrecision(requested_space, 2, true), available: String.FormatSizeWithPrecision(free_space, 2, true))
end
if Bootloader.getLoaderType == "systemd-boot" && @add_crashkernel_param
- if warning_string.length > 0
- warning_string += "
"
- end
+ warning_string += "
" if !warning_string.empty?
warning_string += _("Kdump will not be installed correctly if Systemd Boot is used.")
end
- if warning_string.length > 0
+ if !warning_string.empty?
warning = {
"warning_level" => :warning,
"warning" => ""
@@ -991,11 +990,11 @@ def Import(settings)
@crashkernel_param_values = Array(crash_kernel_values)
end
- if settings.key?("crash_xen_kernel")
+ @crashkernel_xen_param_values = if settings.key?("crash_xen_kernel")
# Make sure it's an array
- @crashkernel_xen_param_values = Array(settings.fetch("crash_xen_kernel", ""))
+ Array(settings.fetch("crash_xen_kernel", ""))
else
- @crashkernel_xen_param_values = Array(crash_xen_kernel_values)
+ Array(crash_xen_kernel_values)
end
@add_crashkernel_param = if settings.key?("add_crash_kernel")
@@ -1187,9 +1186,9 @@ def crash_xen_kernel_values
if @crashkernel_list_ranges
if @crashkernel_xen_param_values.is_a?(Symbol)
return Array(@crashkernel_xen_param_values.to_s)
- else
- return Array(@crashkernel_xen_param_values.dup)
end
+
+ return Array(@crashkernel_xen_param_values.dup)
end
result = []
@@ -1219,24 +1218,22 @@ def crash_xen_kernel_values
# returned by Bootloader.kernel_param
def remove_offsets!(values)
# It could also be :missing or :present
- if values.is_a?(Array)
- values.map! do |value|
- pieces = value.split("@")
- if pieces.size > 1
- Builtins.y2milestone("Delete offset crashkernel value: %1", value)
- end
- pieces.first
- end
+ return unless values.is_a?(Array)
+
+ values.map! do |value|
+ pieces = value.split("@")
+ Builtins.y2milestone("Delete offset crashkernel value: %1", value) if pieces.size > 1
+ pieces.first
end
end
def write_fadump_boot_param
- if fadump_supported?
- # If fdump is selected and we want to enable kdump
- value = "on" if using_fadump? && @add_crashkernel_param
- Bootloader.modify_kernel_params(:common, :recovery, "fadump" => value)
- Bootloader.Write unless Yast::Stage.initial # do mass write in installation to speed up
- end
+ return unless fadump_supported?
+
+ # If fdump is selected and we want to enable kdump
+ value = "on" if using_fadump? && @add_crashkernel_param
+ Bootloader.modify_kernel_params(:common, :recovery, "fadump" => value)
+ Bootloader.Write unless Yast::Stage.initial # do mass write in installation to speed up
end
end
diff --git a/test/auto_test.rb b/test/auto_test.rb
index ee42c72..a158aed 100644
--- a/test/auto_test.rb
+++ b/test/auto_test.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# frozen_string_literal: true
require_relative "./test_helper"
diff --git a/test/fadump_test.rb b/test/fadump_test.rb
index 74042bc..6d720e9 100755
--- a/test/fadump_test.rb
+++ b/test/fadump_test.rb
@@ -1,4 +1,5 @@
#! /usr/bin/env rspec
+# frozen_string_literal: true
require_relative "./test_helper"
diff --git a/test/finish_test.rb b/test/finish_test.rb
index bc95a43..4b41c64 100644
--- a/test/finish_test.rb
+++ b/test/finish_test.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# frozen_string_literal: true
require_relative "./test_helper"
diff --git a/test/include/uifunctions.rb b/test/include/uifunctions.rb
index 4a8c9ed..9849fae 100755
--- a/test/include/uifunctions.rb
+++ b/test/include/uifunctions.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# frozen_string_literal: true
require_relative "../test_helper"
@@ -13,6 +14,7 @@ def main
def initialize
main
+ super
end
# Convenience method to expose @KDUMP_SAVE_TARGET
@@ -69,8 +71,8 @@ def build_target(attrs = {})
it "sets KDUMP_SAVE_TARGET as 'ftp' with server, user_name, password and dir" do
expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true)
expect(client.target).to eq(build_target(
- "target" => "ftp", "user_name" => "user", "password" => "pass",
- "server" => "ftp.suse.com", "dir" => "/pub"
+ "target" => "ftp", "user_name" => "user", "password" => "pass",
+ "server" => "ftp.suse.com", "dir" => "/pub"
))
end
end
@@ -81,7 +83,7 @@ def build_target(attrs = {})
it "sets KDUMP_SAVE_TARGET as 'nfs' with server and dir" do
expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true)
expect(client.target).to eq(build_target(
- "target" => "nfs", "server" => "nfs.suse.cz", "dir" => "/exports"
+ "target" => "nfs", "server" => "nfs.suse.cz", "dir" => "/exports"
))
end
end
@@ -92,8 +94,8 @@ def build_target(attrs = {})
it "sets KDUMP_SAVE_TARGET as 'ssh' with server, port, user_name, password and dir" do
expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true)
expect(client.target).to eq(build_target(
- "target" => "ssh", "user_name" => "user", "password" => "pass",
- "server" => "people.suse.cz", "dir" => "/home/user/kdump", "port" => "9000"
+ "target" => "ssh", "user_name" => "user", "password" => "pass",
+ "server" => "people.suse.cz", "dir" => "/home/user/kdump", "port" => "9000"
))
end
end
@@ -104,8 +106,8 @@ def build_target(attrs = {})
it "sets KDUMP_SAVE_TARGET 'sftp' with server, port, user_name, password and dir" do
expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true)
expect(client.target).to eq(build_target(
- "target" => "sftp", "user_name" => "user", "password" => "pass",
- "server" => "people.suse.cz", "dir" => "/home/user/kdump", "port" => "9000"
+ "target" => "sftp", "user_name" => "user", "password" => "pass",
+ "server" => "people.suse.cz", "dir" => "/home/user/kdump", "port" => "9000"
))
end
end
@@ -116,8 +118,8 @@ def build_target(attrs = {})
it "sets KDUMP_SAVE_TARGET 'cifs' with server, user_name, password, share and dir" do
expect(client.SetUpKDUMP_SAVE_TARGET(target)).to eq(true)
expect(client.target).to eq(build_target(
- "target" => "cifs", "user_name" => "user", "password" => "pass",
- "server" => "people.suse.cz", "dir" => "/user/kdump", "share" => "homes"
+ "target" => "cifs", "user_name" => "user", "password" => "pass",
+ "server" => "people.suse.cz", "dir" => "/user/kdump", "share" => "homes"
))
end
end
diff --git a/test/kdump_test.rb b/test/kdump_test.rb
index ef8e498..20606d1 100755
--- a/test/kdump_test.rb
+++ b/test/kdump_test.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# frozen_string_literal: true
require_relative "./test_helper"
@@ -171,13 +172,13 @@
it "returns space in bytes requested for kernel dump" do
allow(Yast::Kdump).to receive(:total_memory).and_return(total_memory_size_mb)
- expect(Yast::Kdump.space_requested_for_dump_b).to eq(total_memory_size_mb * 1024**2 + 4 * 1024**3)
+ expect(Yast::Kdump.space_requested_for_dump_b).to eq((total_memory_size_mb * (1024**2)) + (4 * (1024**3)))
end
end
describe "#proposal_warning" do
before do
- allow(Yast::Kdump).to receive(:space_requested_for_dump_b).and_return(4 * 1024**3)
+ allow(Yast::Kdump).to receive(:space_requested_for_dump_b).and_return(4 * (1024**3))
Yast::Kdump.instance_variable_set("@add_crashkernel_param", true)
end
@@ -192,7 +193,7 @@
context "when free space is smaller than requested" do
it "returns hash with warning and warning_level keys" do
- allow(Yast::Kdump).to receive(:free_space_for_dump_b).and_return(3978 * 1024**2)
+ allow(Yast::Kdump).to receive(:free_space_for_dump_b).and_return(3978 * (1024**2))
warning = Yast::Kdump.proposal_warning
expect(warning["warning"]).to match(/There might not be enough free space.*only.*are available/)
@@ -202,7 +203,7 @@
context "when free space is bigger or equal to requested size" do
it "returns empty hash" do
- allow(Yast::Kdump).to receive(:free_space_for_dump_b).and_return(120 * 1024**3)
+ allow(Yast::Kdump).to receive(:free_space_for_dump_b).and_return(120 * (1024**3))
warning = Yast::Kdump.proposal_warning
expect(warning).to eq({})
diff --git a/test/lib/kdump/clients/kdump_test.rb b/test/lib/kdump/clients/kdump_test.rb
index 0a3578e..b37c77e 100644
--- a/test/lib/kdump/clients/kdump_test.rb
+++ b/test/lib/kdump/clients/kdump_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../../test_helper"
require "kdump/clients/kdump"
diff --git a/test/lib/kdump/kdump_calibrator_test.rb b/test/lib/kdump/kdump_calibrator_test.rb
index b40757b..e760b60 100644
--- a/test/lib/kdump/kdump_calibrator_test.rb
+++ b/test/lib/kdump/kdump_calibrator_test.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# frozen_string_literal: true
require_relative "../../test_helper"
require "kdump/kdump_calibrator"
diff --git a/test/lib/kdump/kdump_system_test.rb b/test/lib/kdump/kdump_system_test.rb
index cef66cc..a5daf9c 100644
--- a/test/lib/kdump/kdump_system_test.rb
+++ b/test/lib/kdump/kdump_system_test.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env rspec
+# frozen_string_literal: true
require_relative "../../test_helper"
require "kdump/kdump_system"
diff --git a/test/test_helper.rb b/test/test_helper.rb
index fb8cdb7..6cc5f8d 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,4 +1,6 @@
-srcdir = File.expand_path("../../src", __FILE__)
+# frozen_string_literal: true
+
+srcdir = File.expand_path("../src", __dir__)
y2dirs = ENV.fetch("Y2DIR", "").split(":")
ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":")
ENV["LC_ALL"] = "en_US.utf-8"
@@ -23,7 +25,7 @@
SimpleCov.track_files("#{srcdir}/**/*.rb")
# additionally use the LCOV format for on-line code coverage reporting at CI
- if ENV["CI"] || ENV["COVERAGE_LCOV"]
+ if ENV.fetch("CI", nil) || ENV.fetch("COVERAGE_LCOV", nil)
require "simplecov-lcov"
SimpleCov::Formatter::LcovFormatter.config do |c|
From 0690fa8f4135fc6e8c6faf6dd914ba59bee34471 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Thu, 20 Jun 2024 16:36:08 +0200
Subject: [PATCH 11/14] dup frozen string
---
src/modules/Kdump.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index ac3a3d6..8685503 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -829,7 +829,7 @@ def Summary
# @return [Integer] free space in bytes or nil if filesystem is not local or no
# packages proposal is made yet
def free_space_for_dump_b
- kdump_savedir = @KDUMP_SETTINGS.fetch("KDUMP_SAVEDIR", "file:///var/log/dump")
+ kdump_savedir = @KDUMP_SETTINGS.fetch("KDUMP_SAVEDIR", "file:///var/log/dump").dup
log.info "Using savedir #{kdump_savedir}"
if kdump_savedir.start_with?("/")
From 6b280e20e81541ad4e32a9da262efa9afc7b813f Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Fri, 21 Jun 2024 11:00:36 +0200
Subject: [PATCH 12/14] removed frozen_string_literal
---
.rubocop.yml | 3 +++
Rakefile | 2 --
src/clients/kdump.rb | 2 --
src/clients/kdump_auto.rb | 2 --
src/clients/kdump_finish.rb | 2 --
src/clients/kdump_proposal.rb | 2 --
src/include/kdump/complex.rb | 2 --
src/include/kdump/dialogs.rb | 2 --
src/include/kdump/helps.rb | 2 --
src/include/kdump/uifunctions.rb | 2 --
src/include/kdump/wizards.rb | 2 --
src/lib/kdump/clients/auto.rb | 2 --
src/lib/kdump/clients/finish.rb | 2 --
src/lib/kdump/clients/kdump.rb | 1 -
src/lib/kdump/kdump_calibrator.rb | 2 --
src/lib/kdump/kdump_system.rb | 2 --
src/modules/Kdump.rb | 2 --
test/auto_test.rb | 2 --
test/fadump_test.rb | 2 --
test/finish_test.rb | 2 --
test/include/uifunctions.rb | 2 --
test/kdump_test.rb | 2 --
test/lib/kdump/clients/kdump_test.rb | 2 --
test/lib/kdump/kdump_calibrator_test.rb | 2 --
test/lib/kdump/kdump_system_test.rb | 2 --
test/test_helper.rb | 2 --
26 files changed, 3 insertions(+), 49 deletions(-)
diff --git a/.rubocop.yml b/.rubocop.yml
index 80faa97..db201b8 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -2,6 +2,9 @@
inherit_from:
/usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml
+Style/FrozenStringLiteralComment:
+ Enabled: false
+
Metrics/AbcSize:
Max: 129
Exclude:
diff --git a/Rakefile b/Rakefile
index 1dfb659..2432dd5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require "yast/rake"
Yast::Tasks.configuration do |conf|
diff --git a/src/clients/kdump.rb b/src/clients/kdump.rb
index 902458f..017786a 100644
--- a/src/clients/kdump.rb
+++ b/src/clients/kdump.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# Copyright (c) [2006-2021] SUSE LLC
#
# All Rights Reserved.
diff --git a/src/clients/kdump_auto.rb b/src/clients/kdump_auto.rb
index 30cb375..9177222 100644
--- a/src/clients/kdump_auto.rb
+++ b/src/clients/kdump_auto.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require "kdump/clients/auto"
Y2Kdump::Clients::Auto.run
diff --git a/src/clients/kdump_finish.rb b/src/clients/kdump_finish.rb
index fb84734..d6c7914 100644
--- a/src/clients/kdump_finish.rb
+++ b/src/clients/kdump_finish.rb
@@ -1,4 +1,2 @@
-# frozen_string_literal: true
-
require "kdump/clients/finish"
::Y2Kdump::Clients::Finish.run
diff --git a/src/clients/kdump_proposal.rb b/src/clients/kdump_proposal.rb
index 4cf078d..4193eb3 100644
--- a/src/clients/kdump_proposal.rb
+++ b/src/clients/kdump_proposal.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2008 Novell, Inc. All Rights Reserved.
#
diff --git a/src/include/kdump/complex.rb b/src/include/kdump/complex.rb
index d7424c9..17f5432 100644
--- a/src/include/kdump/complex.rb
+++ b/src/include/kdump/complex.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
#
diff --git a/src/include/kdump/dialogs.rb b/src/include/kdump/dialogs.rb
index b35fa56..550c556 100644
--- a/src/include/kdump/dialogs.rb
+++ b/src/include/kdump/dialogs.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
#
diff --git a/src/include/kdump/helps.rb b/src/include/kdump/helps.rb
index 64de70b..a9e51f6 100644
--- a/src/include/kdump/helps.rb
+++ b/src/include/kdump/helps.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
#
diff --git a/src/include/kdump/uifunctions.rb b/src/include/kdump/uifunctions.rb
index 34f9ecb..3992622 100644
--- a/src/include/kdump/uifunctions.rb
+++ b/src/include/kdump/uifunctions.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
#
diff --git a/src/include/kdump/wizards.rb b/src/include/kdump/wizards.rb
index b83610e..1016162 100644
--- a/src/include/kdump/wizards.rb
+++ b/src/include/kdump/wizards.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
#
diff --git a/src/lib/kdump/clients/auto.rb b/src/lib/kdump/clients/auto.rb
index 620db6f..daa09bb 100644
--- a/src/lib/kdump/clients/auto.rb
+++ b/src/lib/kdump/clients/auto.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2019 SUSE LLC
#
diff --git a/src/lib/kdump/clients/finish.rb b/src/lib/kdump/clients/finish.rb
index dc32b85..94f76ab 100644
--- a/src/lib/kdump/clients/finish.rb
+++ b/src/lib/kdump/clients/finish.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2017 SUSE LLC
#
diff --git a/src/lib/kdump/clients/kdump.rb b/src/lib/kdump/clients/kdump.rb
index 46a9e44..0307813 100644
--- a/src/lib/kdump/clients/kdump.rb
+++ b/src/lib/kdump/clients/kdump.rb
@@ -16,7 +16,6 @@
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
-# frozen_string_literal: true
Yast.import "UI"
Yast.import "Progress"
diff --git a/src/lib/kdump/kdump_calibrator.rb b/src/lib/kdump/kdump_calibrator.rb
index 36860f5..e6d48be 100644
--- a/src/lib/kdump/kdump_calibrator.rb
+++ b/src/lib/kdump/kdump_calibrator.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require "yast"
require "kdump/kdump_system"
diff --git a/src/lib/kdump/kdump_system.rb b/src/lib/kdump/kdump_system.rb
index 5ba8654..e83c491 100644
--- a/src/lib/kdump/kdump_system.rb
+++ b/src/lib/kdump/kdump_system.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) [2018] SUSE LLC
#
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 8685503..6fe4173 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
# ------------------------------------------------------------------------------
# Copyright (c) 2006 Novell, Inc. All Rights Reserved.
#
diff --git a/test/auto_test.rb b/test/auto_test.rb
index a158aed..b38ad50 100644
--- a/test/auto_test.rb
+++ b/test/auto_test.rb
@@ -1,6 +1,4 @@
#!/usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "./test_helper"
require "kdump/clients/auto"
diff --git a/test/fadump_test.rb b/test/fadump_test.rb
index 6d720e9..39dc864 100755
--- a/test/fadump_test.rb
+++ b/test/fadump_test.rb
@@ -1,6 +1,4 @@
#! /usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "./test_helper"
Yast.import "Kdump"
diff --git a/test/finish_test.rb b/test/finish_test.rb
index 4b41c64..65ae580 100644
--- a/test/finish_test.rb
+++ b/test/finish_test.rb
@@ -1,6 +1,4 @@
#!/usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "./test_helper"
require "kdump/clients/finish"
diff --git a/test/include/uifunctions.rb b/test/include/uifunctions.rb
index 9849fae..ae2818a 100755
--- a/test/include/uifunctions.rb
+++ b/test/include/uifunctions.rb
@@ -1,6 +1,4 @@
#!/usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "../test_helper"
describe "Yast::KdumpUifunctionsInclude" do
diff --git a/test/kdump_test.rb b/test/kdump_test.rb
index 20606d1..f572d82 100755
--- a/test/kdump_test.rb
+++ b/test/kdump_test.rb
@@ -1,6 +1,4 @@
#!/usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "./test_helper"
Yast.import "Kdump"
diff --git a/test/lib/kdump/clients/kdump_test.rb b/test/lib/kdump/clients/kdump_test.rb
index b37c77e..0a3578e 100644
--- a/test/lib/kdump/clients/kdump_test.rb
+++ b/test/lib/kdump/clients/kdump_test.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
require_relative "../../../test_helper"
require "kdump/clients/kdump"
diff --git a/test/lib/kdump/kdump_calibrator_test.rb b/test/lib/kdump/kdump_calibrator_test.rb
index e760b60..7851ab5 100644
--- a/test/lib/kdump/kdump_calibrator_test.rb
+++ b/test/lib/kdump/kdump_calibrator_test.rb
@@ -1,6 +1,4 @@
#!/usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "../../test_helper"
require "kdump/kdump_calibrator"
diff --git a/test/lib/kdump/kdump_system_test.rb b/test/lib/kdump/kdump_system_test.rb
index a5daf9c..d3a5ed6 100644
--- a/test/lib/kdump/kdump_system_test.rb
+++ b/test/lib/kdump/kdump_system_test.rb
@@ -1,6 +1,4 @@
#!/usr/bin/env rspec
-# frozen_string_literal: true
-
require_relative "../../test_helper"
require "kdump/kdump_system"
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 6cc5f8d..6bdb925 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
srcdir = File.expand_path("../src", __dir__)
y2dirs = ENV.fetch("Y2DIR", "").split(":")
ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":")
From cd48f56efd125463ee9a73a7590913964a30e3e9 Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Fri, 21 Jun 2024 11:03:32 +0200
Subject: [PATCH 13/14] freeze constants
---
src/lib/kdump/kdump_calibrator.rb | 4 ++--
src/modules/Kdump.rb | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lib/kdump/kdump_calibrator.rb b/src/lib/kdump/kdump_calibrator.rb
index e6d48be..6d149f4 100644
--- a/src/lib/kdump/kdump_calibrator.rb
+++ b/src/lib/kdump/kdump_calibrator.rb
@@ -11,8 +11,8 @@ module Yast
class KdumpCalibrator
include Yast::Logger
- KDUMPTOOL_CMD = "/usr/sbin/kdumptool %s calibrate"
- KDUMPTOOL_ARG = "--configfile '%s'"
+ KDUMPTOOL_CMD = "/usr/sbin/kdumptool %s calibrate".freeze
+ KDUMPTOOL_ARG = "--configfile '%s'".freeze
KEYS_MAP = {
"Low" => :default_low,
"MinLow" => :min_low,
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 6fe4173..10d9202 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -36,10 +36,10 @@ module Yast
class KdumpClass < Module
include Yast::Logger
- FADUMP_KEY = "KDUMP_FADUMP"
- KDUMP_SERVICE_NAME = "kdump"
+ FADUMP_KEY = "KDUMP_FADUMP".freeze
+ KDUMP_SERVICE_NAME = "kdump".freeze
KDUMP_PACKAGES = ["kexec-tools", "kdump"].freeze
- TEMPORARY_CONFIG_FILE = "/var/lib/YaST2/kdump.sysconfig"
+ TEMPORARY_CONFIG_FILE = "/var/lib/YaST2/kdump.sysconfig".freeze
TEMPORARY_CONFIG_PATH = Path.new(".temporary.sysconfig.kdump")
# Space on disk reserved for dump additionally to memory size in bytes
From b4fe5f6b2e2cd56af7d35f94aa70fb198144566c Mon Sep 17 00:00:00 2001
From: Stefan Schubert
Date: Fri, 21 Jun 2024 11:09:04 +0200
Subject: [PATCH 14/14] replacing -if not- with -unless-
---
src/modules/Kdump.rb | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/modules/Kdump.rb b/src/modules/Kdump.rb
index 10d9202..55e6680 100644
--- a/src/modules/Kdump.rb
+++ b/src/modules/Kdump.rb
@@ -180,7 +180,7 @@ def reset
# Abort function
# @return [Boolean] return true if abort
def Abort
- return @AbortFunction.call == true if !@AbortFunction.nil?
+ return @AbortFunction.call == true unless @AbortFunction.nil?
false
end
@@ -210,12 +210,12 @@ def SetModified
# FileUtils::Chmod ("/etc/sysconfig/kdump", "600") -> true
# FileUtils::Chmod ("/tmp/doesnt_exist", "644") -> false
def Chmod(target, permissions)
- if !FileUtils.Exists(target)
+ unless FileUtils.Exists(target)
Builtins.y2error("Target %1 doesn't exist", target)
return false
end
- if !FileUtils.Exists("/bin/chmod")
+ unless FileUtils.Exists("/bin/chmod")
Builtins.y2error("tool: /bin/chmod not found")
return false
end
@@ -245,7 +245,7 @@ def checkPassword
return false
end
- return false if !Ops.get(@KDUMP_SETTINGS, "KDUMP_SAVEDIR", "").include?("@")
+ return false unless Ops.get(@KDUMP_SETTINGS, "KDUMP_SAVEDIR", "").include?("@")
temp = Builtins.splitstring(
Ops.get(@KDUMP_SETTINGS, "KDUMP_SAVEDIR", ""),
@@ -491,7 +491,7 @@ def WriteKdumpBootParameter
Bootloader.modify_kernel_params(:common, :recovery, "crashkernel" => crash_values)
Bootloader.modify_kernel_params(:xen_host, "crashkernel" => crash_xen_values)
# do mass write in installation to speed up, so skip this one
- if !Stage.initial
+ unless Stage.initial
old_progress = Progress.set(false)
Bootloader.Write
Progress.set(old_progress)
@@ -512,7 +512,7 @@ def WriteKdumpBootParameter
if @crashkernel_param
# delete crashkernel parameter from bootloader
Bootloader.modify_kernel_params(:common, :xen_guest, :recovery, :xen_host, "crashkernel" => :missing)
- if !Stage.initial
+ unless Stage.initial
old_progress = Progress.set(false)
Bootloader.Write
Progress.set(old_progress)
@@ -567,14 +567,14 @@ def Read
Progress.NextStage
# Error message
- Report.Error(_("Cannot read config file /etc/sysconfig/kdump")) if !ReadKdumpSettings()
+ Report.Error(_("Cannot read config file /etc/sysconfig/kdump")) unless ReadKdumpSettings()
# read another database
return false if Abort()
Progress.NextStep
# Error message
- Report.Error(_("Cannot read kernel boot options.")) if !ReadKdumpKernelParam()
+ Report.Error(_("Cannot read kernel boot options.")) unless ReadKdumpKernelParam()
# read another database
return false if Abort()
@@ -647,7 +647,7 @@ def Write
Progress.NextStage
# Error message
- if !WriteKdumpSettings()
+ unless WriteKdumpSettings()
Report.Error(_("Cannot write settings."))
return false
end
@@ -657,7 +657,7 @@ def Write
Progress.NextStage
# Error message
- if !WriteKdumpBootParameter()
+ unless WriteKdumpBootParameter()
Report.Error(_("Adding crashkernel parameter to bootloader fault."))
end
@@ -736,7 +736,7 @@ def CheckPackages
@kdump_packages.each do |p|
PackagesProposal.AddResolvables("yast2-kdump", :package, [p])
end
- if !@kdump_packages.empty?
+ unless @kdump_packages.empty?
Builtins.y2milestone(
"Selected kdump packages for installation: %1",
@kdump_packages
@@ -750,7 +750,7 @@ def CheckPackages
@kdump_packages.each do |p|
PackagesProposal.RemoveResolvables("yast2-kdump", :package, [p])
end
- if !@kdump_packages.empty?
+ unless @kdump_packages.empty?
Builtins.y2milestone(
"Deselected kdump packages for installation: %1",
@kdump_packages
@@ -911,11 +911,11 @@ def proposal_warning
end
if Bootloader.getLoaderType == "systemd-boot" && @add_crashkernel_param
- warning_string += "
" if !warning_string.empty?
+ warning_string += "
" unless warning_string.empty?
warning_string += _("Kdump will not be installed correctly if Systemd Boot is used.")
end
- if !warning_string.empty?
+ unless warning_string.empty?
warning = {
"warning_level" => :warning,
"warning" => ""