Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from yast/mkdumprd
make the kdump initrd before the FS becomes read only
- Loading branch information
Showing
8 changed files
with
137 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,2 @@ | ||
# encoding: utf-8 | ||
|
||
# File: | ||
# kdump_finish.ycp | ||
# | ||
# Module: | ||
# Step of base installation finish | ||
# | ||
# Authors: | ||
# Jozef Uhliarik <juhliarik@suse.cz> | ||
# | ||
# | ||
module Yast | ||
class KdumpFinishClient < Client | ||
def main | ||
|
||
textdomain "kdump" | ||
|
||
Yast.import "Kdump" | ||
Yast.import "Mode" | ||
Yast.import "Progress" | ||
|
||
@ret = nil | ||
@func = "" | ||
@param = {} | ||
|
||
# Check arguments | ||
if Ops.greater_than(Builtins.size(WFM.Args), 0) && | ||
Ops.is_string?(WFM.Args(0)) | ||
@func = Convert.to_string(WFM.Args(0)) | ||
if Ops.greater_than(Builtins.size(WFM.Args), 1) && | ||
Ops.is_map?(WFM.Args(1)) | ||
@param = Convert.to_map(WFM.Args(1)) | ||
end | ||
end | ||
|
||
@progress_orig = Progress.set(false) | ||
|
||
Builtins.y2milestone("starting kdump_finish") | ||
Builtins.y2debug("func=%1", @func) | ||
Builtins.y2debug("param=%1", @param) | ||
|
||
if @func == "Info" | ||
return { | ||
"steps" => 3, | ||
# progress step title | ||
"title" => _("Saving kdump configuration..."), | ||
"when" => [:installation, :update, :autoinst] | ||
} | ||
elsif @func == "Write" | ||
# propose settings for kdump if autoyast doesn't include settings for yast2-kdump | ||
Kdump.Propose if !Kdump.import_called && (Mode.autoinst || Mode.autoupgrade) | ||
if Mode.update | ||
Kdump.Update | ||
else | ||
Kdump.Write | ||
end | ||
else | ||
Builtins.y2error("unknown function: %1", @func) | ||
@ret = nil | ||
end | ||
Progress.set(@progress_orig) | ||
Builtins.y2debug("ret=%1", @ret) | ||
Builtins.y2milestone("kdump_finish finished") | ||
deep_copy(@ret) | ||
end | ||
end | ||
end | ||
|
||
Yast::KdumpFinishClient.new.main | ||
require "kdump/clients/finish" | ||
::Y2Kdump::Clients::Finish.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# encoding: utf-8 | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2017 SUSE LLC | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "installation/finish_client" | ||
|
||
module Y2Kdump | ||
module Clients | ||
class Finish < ::Installation::FinishClient | ||
def initialize | ||
textdomain "kdump" | ||
|
||
Yast.import "Kdump" | ||
Yast.import "Mode" | ||
Yast.import "Progress" | ||
end | ||
|
||
def title | ||
# progress step title | ||
_("Saving kdump configuration...") | ||
end | ||
|
||
def modes | ||
[:installation, :update, :autoinst] | ||
end | ||
|
||
def steps | ||
3 | ||
end | ||
|
||
def write | ||
progress_orig = Progress.set(false) | ||
# propose settings for kdump | ||
# if autoyast doesn't include settings for yast2-kdump | ||
Kdump.Propose if !Kdump.import_called && Mode.auto | ||
if Mode.update | ||
Kdump.Update | ||
else | ||
Kdump.Write | ||
end | ||
Progress.set(progress_orig) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env rspec | ||
|
||
require_relative "./test_helper" | ||
|
||
require "kdump/clients/finish" | ||
|
||
describe Y2Kdump::Clients::Finish do | ||
describe "#steps" do | ||
it "returns an integer" do | ||
expect(subject.steps).to be_an Integer | ||
end | ||
end | ||
|
||
describe "#title" do | ||
it "returns a string" do | ||
expect(subject.title).to be_a String | ||
end | ||
end | ||
|
||
describe "#modes" do | ||
it "returns a list" do | ||
modes = subject.modes | ||
# If we want to make this a generic FinishClient test, | ||
# remember the API allows a nil | ||
expect(modes).to be_an Array | ||
modes.each do |m| | ||
# elements are fixed symbol values | ||
expect(m).to be_a Symbol | ||
end | ||
end | ||
end | ||
|
||
describe "#write" do | ||
before do | ||
allow(Yast::Kdump).to receive(:Propose) | ||
Yast::Kdump.import_called = false | ||
end | ||
|
||
it "calls Kdump.Write for installing" do | ||
expect(Yast::Mode).to receive(:update).and_return(false) | ||
expect(Yast::Kdump).to receive(:Write) | ||
subject.write | ||
end | ||
|
||
it "calls Kdump.Update for updating" do | ||
expect(Yast::Mode).to receive(:update).and_return(true) | ||
expect(Yast::Kdump).to receive(:Update) | ||
subject.write | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters