kdump: Apply strict equality everywhere

This commit is contained in:
Jelle van der Waa 2026-10-16 13:50:43 +02:00 committed by Jelle van der Waa
parent fd00db13c5
commit cf9064dc21
3 changed files with 21 additions and 21 deletions

View file

@ -37,7 +37,7 @@ export class ConfigFileSUSE extends ConfigFile {
}
// if nothing changed, don't bother parsing the content
if (rawContent == this._rawContent)
if (rawContent === this._rawContent)
return;
this._rawContent = rawContent;
@ -206,7 +206,7 @@ export class ConfigFileSUSE extends ConfigFile {
this._updateSetting(settings, "KDUMP_SAVEDIR", savedir);
}
// compression
if (this.settings.compression.enabled != settings.compression.enabled) {
if (this.settings.compression.enabled !== settings.compression.enabled) {
if (settings.compression.enabled) {
this._updateSetting(settings, "KDUMP_DUMPFORMAT", "compressed");
} else {

View file

@ -66,7 +66,7 @@ export class ConfigFile {
return;
}
if (rawContent == this._rawContent)
if (rawContent === this._rawContent)
return;
// if (skipNotify === undefined)
@ -188,7 +188,7 @@ export class ConfigFile {
this.settings.compression.enabled = (
("core_collector" in this.settings._internal) &&
this.settings._internal.core_collector.value &&
(this.settings._internal.core_collector.value.split(" ").indexOf("-c") != -1)
(this.settings._internal.core_collector.value.split(" ").indexOf("-c") !== -1)
);
this.settings.core_collector = this.settings._internal?.core_collector?.value ?? defaultCoreCollector;
@ -222,9 +222,9 @@ export class ConfigFile {
// wipe old target settings
for (const key in this.settings.targets) {
const oldTarget = this.settings.targets[key];
if (oldTarget.type == "mount") {
if (oldTarget.type === "mount") {
delete settings._internal[oldTarget.fsType];
} else if (oldTarget.type == "ssh") {
} else if (oldTarget.type === "ssh") {
delete settings._internal.ssh;
delete settings._internal.sshkey;
} else {
@ -253,7 +253,7 @@ export class ConfigFile {
settings._internal.core_collector.value =
settings._internal.core_collector.value
.split(" ")
.filter(e => e != "-F")
.filter(e => e !== "-F")
.join(" ");
} else {
settings._internal.core_collector = { value: defaultCoreCollector };
@ -263,7 +263,7 @@ export class ConfigFile {
}
}
// compression
if (this.settings.compression.enabled != settings.compression.enabled) {
if (this.settings.compression.enabled !== settings.compression.enabled) {
if (settings.compression.enabled) {
// enable compression
if ("core_collector" in settings._internal)
@ -277,7 +277,7 @@ export class ConfigFile {
settings._internal.core_collector.value =
settings._internal.core_collector.value
.split(" ")
.filter((e) => { return (e != "-c") })
.filter((e) => { return (e !== "-c") })
.join(" ");
} else {
// if we don't have anything on this in the original settings,

View file

@ -105,7 +105,7 @@ function getLocation(target, config) {
if (target.type === "ssh") {
path = `${target.server}:${path}`;
} else if (target.type == "nfs") {
} else if (target.type === "nfs") {
if (!config.nfs_supports_directory) {
path = '';
}
@ -396,7 +396,7 @@ export class KdumpPage extends React.Component {
' ' + _("Results of the crash will be stored in $0 as $1, if kdump is properly configured."),
<span className="pf-v6-u-font-family-monospace-vf">{path}</span>,
<span className="pf-v6-u-font-family-monospace-vf">vmcore</span>);
} else if (target.type === "ssh" || target.type == "nfs") {
} else if (target.type === "ssh" || target.type === "nfs") {
verifyMessage = fmt_to_fragments(
' ' + _("Results of the crash will be copied through $0 to $1 as $2, if kdump is properly configured."),
<span className="pf-v6-u-font-family-monospace-vf">{target.type === "ssh" ? "SSH" : "NFS"}</span>,
@ -474,26 +474,26 @@ ${enableCrashKernel}
kdumpLocation = _("invalid: multiple targets defined");
} else {
const locationPath = getLocation(target, this.props.kdumpStatus.config);
if (target.type == "local") {
if (target.type === "local") {
kdumpLocation = cockpit.format(_("Local, $0"), locationPath);
targetCanChange = true;
} else if (target.type == "ssh") {
} else if (target.type === "ssh") {
kdumpLocation = cockpit.format(_("Remote over SSH, $0"), locationPath);
targetCanChange = true;
} else if (target.type == "nfs") {
} else if (target.type === "nfs") {
kdumpLocation = cockpit.format(_("Remote over NFS, $0"), locationPath);
targetCanChange = true;
} else if (target.type == "raw") {
} else if (target.type === "raw") {
kdumpLocation = _("Raw to a device");
} else if (target.type == "mount") {
} else if (target.type === "mount") {
/* mount targets outside of nfs are too complex for the
* current target dialog */
kdumpLocation = _("On a mounted device");
} else if (target.type == "ftp") {
} else if (target.type === "ftp") {
kdumpLocation = _("Remote over FTP");
} else if (target.type == "sftp") {
} else if (target.type === "sftp") {
kdumpLocation = _("Remote over SFTP");
} else if (target.type == "cifs") {
} else if (target.type === "cifs") {
kdumpLocation = _("Remote over CIFS/SMB");
} else {
kdumpLocation = _("No configuration found");
@ -573,7 +573,7 @@ ${enableCrashKernel}
let alertDetail;
if (!this.props.stateChanging && this.props.kdumpStatus && this.props.kdumpStatus.installed !== undefined) {
if (this.props.kdumpStatus.installed) {
if (this.props.reservedMemory == 0) {
if (this.props.reservedMemory === 0) {
alertMessage = fmt_to_fragments(
_("Kernel did not boot with the $0 setting"),
<span className="pf-v6-u-font-family-monospace-vf">crashkernel</span>
@ -585,7 +585,7 @@ ${enableCrashKernel}
<span className="pf-v6-u-font-family-monospace-vf">GRUB_CMDLINE_LINUX</span>,
<span className="pf-v6-u-font-family-monospace-vf">/etc/default/grub</span>
);
} else if (this.props.kdumpStatus.state == "failed") {
} else if (this.props.kdumpStatus.state === "failed") {
alertMessage = (
<>
{_("Service has an error")}