Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into security_proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 22, 2021
2 parents 4549640 + dfd4755 commit 5f89d59
Show file tree
Hide file tree
Showing 9 changed files with 314 additions and 126 deletions.
335 changes: 229 additions & 106 deletions doc/control-file.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions package/yast2-installation.changes
@@ -1,3 +1,17 @@
-------------------------------------------------------------------
Thu Feb 18 21:34:23 UTC 2021 - Josef Reidinger <jreidinger@suse.com>

- Adapted unit test to recent changes in Yast::Report (related to
bsc#1179893).
- 4.3.26

-------------------------------------------------------------------
Wed Feb 10 08:01:33 UTC 2021 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Do not crash when it is not possible to create a snapshot after
installing or upgrading the system (bsc#1180142).
- 4.3.25

-------------------------------------------------------------------
Mon Dec 7 09:27:38 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
10 changes: 5 additions & 5 deletions package/yast2-installation.spec
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-installation
Version: 4.3.24
Version: 4.3.26
Release: 0
Group: System/YaST
License: GPL-2.0-only
Expand All @@ -35,8 +35,8 @@ BuildRequires: yast2-ruby-bindings >= 4.0.6
BuildRequires: yast2-xml
BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec)
BuildRequires: rubygem(%{rb_default_ruby_abi}:yast-rake)
# Yast::OSRelease.ReleaseVersionHumanReadable
BuildRequires: yast2 >= 4.2.56
# Yast2::FsSnapshotStore::IOError
BuildRequires: yast2 >= 4.3.53
# Y2Packager::MediumType
BuildRequires: yast2-packager >= 4.2.27
# CIOIgnore
Expand Down Expand Up @@ -78,8 +78,8 @@ Requires: yast2-proxy
# Systemd default target and services. This version supports
# writing settings in the first installation stage.
Requires: yast2-services-manager >= 3.2.1
# UI::Wizards::Layout
Requires: yast2 >= 4.3.16
# Yast2::FsSnapshotStore::IOError
Requires: yast2 >= 4.3.53
# Y2Network::NtpServer
Requires: yast2-network >= 4.2.55
# for AbortException and handle direct abort
Expand Down
24 changes: 13 additions & 11 deletions src/lib/installation/dialogs/security.rb
Expand Up @@ -104,23 +104,23 @@ def selinux_configurable?

def firewall_frame
frame(
_("Firewall and SSH service"),
Y2Firewall::Widgets::FirewallSSHProposal.new(@settings)
)
_("Firewall and SSH service"),
Y2Firewall::Widgets::FirewallSSHProposal.new(@settings)
)
end

def polkit_frame
frame(
_("PolicyKit),
PolkitDefaultPriv.new(@settings)
)
_("PolicyKit"),
PolkitDefaultPriv.new(@settings)
)
end

def cpu_frame
frame(
_("CPU),
::Bootloader::Grub2Widget::CpuMitigationsWidget.new)
)
_("CPU"),
::Bootloader::CpuMitigationsWidget.new
)
end

def selinux_frame
Expand All @@ -131,7 +131,8 @@ def selinux_frame
end

def frame(label, widget)
Left(Frame(
Left(
Frame(
label,
HSquash(
MarginBox(
Expand All @@ -140,7 +141,8 @@ def frame(label, widget)
widget
)
)
))
)
)
end
end

Expand Down
9 changes: 9 additions & 0 deletions src/lib/installation/snapshots_finish.rb
Expand Up @@ -12,6 +12,7 @@ def initialize

Yast.import "Mode"
Yast.import "InstFunctions"
Yast.import "Report"
Yast.include self, "installation/misc.rb"
end

Expand Down Expand Up @@ -52,12 +53,20 @@ def create_post_snapshot
Yast2::FsSnapshot.create_post("after update", pre_number, cleanup: :number, important: true)
Yast2::FsSnapshotStore.clean("update")
true
rescue Yast2::SnapshotCreationFailed, Yast2::FsSnapshotStore::IOError => error
log.error("Error creating a post-update snapshot: #{error}")
Yast::Report.Error(_("Could not create a post-update snapshot."))
false
end

def create_single_snapshot
# as of bsc #1092757 snapshot descriptions are not translated
Yast2::FsSnapshot.create_single("after installation", cleanup: :number, important: true)
true
rescue Yast2::SnapshotCreationFailed => error
log.error("Error creating a post-installation snapshot: #{error}")
Yast::Report.Error(_("Could not create a post-installation snapshot."))
false
end

def snapper_config
Expand Down
7 changes: 7 additions & 0 deletions test/cio_ignore_test.rb
Expand Up @@ -4,7 +4,13 @@

require "installation/cio_ignore"

Yast.import "Bootloader"

describe ::Installation::CIOIgnore do
before do
allow(Yast::Bootloader).to receive(:kernel_param).with(:common, "rd.zdev")
end

describe "cio_ignore enable/disable" do
it "take AutoYaST cio_ignore setting" do
allow(Yast::Mode).to receive(:autoinst).and_return(true)
Expand All @@ -27,6 +33,7 @@
subject { ::Installation::CIOIgnoreProposal.new }

before(:each) do
allow(Yast::Bootloader).to receive(:kernel_param).with(:common, "rd.zdev")
::Installation::CIOIgnore.instance.reset
end

Expand Down
3 changes: 2 additions & 1 deletion test/image_installation_test.rb
Expand Up @@ -79,8 +79,9 @@
expect(subject.FindImageSet([])).to eq true
end

it "returns false if xml is not valid" do
it "returns false and reports error if xml is not valid" do
allow(Yast::XML).to receive(:XMLToYCPFile).and_raise(Yast::XMLDeserializationError)
expect(Yast::Report).to receive(:Error)

expect(subject.FindImageSet([])).to eq false
end
Expand Down
2 changes: 1 addition & 1 deletion test/inst_update_installer_test.rb
Expand Up @@ -147,7 +147,7 @@

context "when the update cannot be fetched from a user defined repository" do
it "shows an error and returns :next" do
expect(Yast::Popup).to receive(:Error)
expect(Yast::Report).to receive(:Error)
expect(manager).to receive(:add_repository)
.and_raise(::Installation::UpdatesManager::CouldNotFetchUpdateFromRepo)
expect(subject.main).to eq(:next)
Expand Down
36 changes: 34 additions & 2 deletions test/snapshots_finish_test.rb
Expand Up @@ -98,14 +98,30 @@
context "when updating" do
before do
allow(Yast::Mode).to receive(:update).and_return(true)
allow(Yast2::FsSnapshotStore).to receive(:load).with("update").and_return(1)
allow(Yast2::FsSnapshotStore).to receive(:clean).with("update")
end

it "creates a snapshot of type 'post' with 'after update' as description and paired with 'pre' snapshot" do
expect(Yast2::FsSnapshotStore).to receive(:load).with("update").and_return(1)
expect(Yast2::FsSnapshotStore).to receive(:clean).with("update")
expect(Yast2::FsSnapshot).to receive(:create_post).with("after update", 1, cleanup: :number, important: true).and_return(true)
expect(subject.write).to eq(true)
end

context "and could not create the snapshot" do
before do
allow(Yast2::FsSnapshot).to receive(:create_post).and_raise(Yast2::SnapshotCreationFailed)
allow(Yast::Report).to receive(:Error)
end

it "returns false" do
expect(subject.write).to eq(false)
end

it "reports the problem to the user" do
expect(Yast::Report).to receive(:Error).with(/snapshot/)
subject.write
end
end
end

context "when installing" do
Expand All @@ -117,6 +133,22 @@
expect(Yast2::FsSnapshot).to receive(:create_single).with("after installation", cleanup: :number, important: true).and_return(true)
expect(subject.write).to eq(true)
end

context "and could not create the snapshot" do
before do
allow(Yast2::FsSnapshot).to receive(:create_single).and_raise(Yast2::SnapshotCreationFailed)
allow(Yast::Report).to receive(:Error)
end

it "returns false" do
expect(subject.write).to eq(false)
end

it "reports the problem to the user" do
expect(Yast::Report).to receive(:Error).with(/snapshot/)
subject.write
end
end
end
end

Expand Down

0 comments on commit 5f89d59

Please sign in to comment.