Skip to content

Commit

Permalink
kdump: always set kdump.conf defaults
Browse files Browse the repository at this point in the history
When an administrator clears core_collector setting and we save a new
configuration the core_collector value is set to `makedumpfile` without
arguments. This is an invalid setting for kdump and not what the
kdump.conf man page recommends as default setting.

The downside of hardcoding the default recommendation is that it may
change over time, so this change includes a test to validate that when
absent we re-set the default value.
  • Loading branch information
jelly committed Oct 4, 2023
1 parent 33bb655 commit 2940fd2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/kdump/config-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ export class ConfigFile {
.split(" ")
.filter(e => e != "-F")
.join(" ");
} else {
settings._internal.core_collector = { value: "makedumpfile -l --message-level 7 -d 31" };
if (target.type === "ssh") {
settings._internal.core_collector.value += " -F";
}
}
}
// compression
Expand All @@ -273,7 +278,7 @@ export class ConfigFile {
if ("core_collector" in settings._internal)
settings._internal.core_collector.value = settings._internal.core_collector.value + " -c";
else
settings._internal.core_collector = { value: "makedumpfile -c" };
settings._internal.core_collector = { value: "makedumpfile -l --message-level 7 -d 31 -c" };
} else {
// disable compression
if ("core_collector" in this.settings._internal) {
Expand Down
14 changes: 14 additions & 0 deletions test/verify/check-kdump
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ class TestKdump(KdumpHelpers):
self.login_and_go("/kdump")
b.wait_visible("#app")

# Check defaults
current = m.execute("grep '^core_collector' /etc/kdump.conf").strip()
m.execute("sed -i /^core_collector/d /etc/kdump.conf")
# Drop the custom path so we can make sure our changes are synced to JavaScript
m.execute("sed -i 's#^path /var/crash#path /var/tmp#' /etc/kdump.conf")
b.wait_text("#kdump-change-target", "locally in /var/tmp")
b.click("#kdump-change-target")
b.wait_visible("#kdump-settings-dialog")
b.set_input_text("#kdump-settings-local-directory", "/var/crash")
b.click("button:contains('Save')")
b.wait_not_present("#kdump-settings-dialog")
new = m.execute("grep '^core_collector' /etc/kdump.conf").strip()
self.assertEqual(current, new)

# Check remote ssh location
b.click("#kdump-change-target")
b.wait_visible("#kdump-settings-dialog")
Expand Down

0 comments on commit 2940fd2

Please sign in to comment.