Skip to content

Commit

Permalink
Merge 02a449e into 40c9845
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 30, 2019
2 parents 40c9845 + 02a449e commit b711b55
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions package/yast2-kdump.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Oct 30 10:48:37 UTC 2019 - Josef Reidinger <jreidinger@suse.com>

- fix crash for empty kdump section (related to change for
bsc#1149208)
- 4.2.6

-------------------------------------------------------------------
Thu Sep 26 12:25:08 UTC 2019 - Josef Reidinger <jreidinger@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-kdump.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-kdump
Version: 4.2.5
Version: 4.2.6
Release: 0
Summary: Configuration of kdump
License: GPL-2.0-only
Expand Down
15 changes: 7 additions & 8 deletions src/modules/Kdump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -946,19 +946,19 @@ def Export
end

# Import settings from a map
# @param [Hash] settings map of kdump settings
# @param [Hash, nil] settings map of kdump settings
# @return [Boolean] true on success
def Import(settings)
settings = deep_copy(settings)
Builtins.y2milestone("Importing settings for kdump")
settings ||= {}
Builtins.y2milestone("Importing settings for kdump #{settings.inspect}")

my_import_map = Ops.get_map(settings, "general", {})
@DEFAULT_CONFIG.each_pair do |key, def_value|
value = my_import_map[key]
@KDUMP_SETTINGS[key] = value.nil? ? def_value : value
end

if Builtins.haskey(settings, "crash_kernel")
if settings.key?("crash_kernel")
# Make sure it's an array
@crashkernel_param_values = Array(settings.fetch("crash_kernel", ""))
# In order not to overwrite the values by the proposal we will have to set
Expand All @@ -971,7 +971,7 @@ def Import(settings)
@crashkernel_param_values = Array(crash_kernel_values)
end

if Builtins.haskey(settings, "crash_xen_kernel")
if settings.key?("crash_xen_kernel")
# Make sure it's an array
@crashkernel_xen_param_values = Array(settings.fetch("crash_xen_kernel", ""))
else
Expand All @@ -984,9 +984,8 @@ def Import(settings)
ProposeCrashkernelParam()
end

if Builtins.haskey(settings, "crash_kernel") ||
Builtins.haskey(settings, "add_crash_kernel") ||
Ops.greater_than(Builtins.size(my_import_map), 0)
if settings.key?("crash_kernel") || settings.key?("add_crash_kernel") ||
!my_import_map.empty?
@import_called = true
end

Expand Down
5 changes: 5 additions & 0 deletions test/kdump_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -842,4 +842,9 @@
end
end

describe ".Import" do
it "does not crash for nil parameter" do
expect { Yast::Kdump.Import(nil) }.to_not raise_error
end
end
end

0 comments on commit b711b55

Please sign in to comment.