Skip to content

Commit

Permalink
Merge pull request #718 from yast/bsc_1097661
Browse files Browse the repository at this point in the history
Do not crash in case /etc/os-release is a directory
  • Loading branch information
teclator committed Jul 26, 2018
2 parents 7c16066 + 031e5d3 commit 61fff46
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions package/yast2-installation.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jul 26 15:45:03 UTC 2018 - knut.anderssen@suse.com

- Do not crash if /etc/os-release is a directory (bsc#1097661)
- 4.0.69

-------------------------------------------------------------------
Thu Jul 26 14:34:27 CEST 2018 - schubi@suse.de

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

Name: yast2-installation
Version: 4.0.68
Version: 4.0.69
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
3 changes: 2 additions & 1 deletion src/lib/installation/ssh_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def name_for(mount_point)
name += " #{os_release["VERSION"]}"
end
name
rescue Errno::ENOENT # No /etc/os-release found
rescue IOError, SystemCallError, RuntimeError => error
log.error("Reading /etc/os-release failed with exception: #{error.inspect}")
default_name
end

Expand Down
Empty file.
5 changes: 4 additions & 1 deletion test/ssh_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
let(:root1_dir) { FIXTURES_DIR.join("root1") }
let(:root2_dir) { FIXTURES_DIR.join("root2") }
let(:root3_dir) { FIXTURES_DIR.join("root3") }
let(:root4_dir) { FIXTURES_DIR.join("root4") }

before do
# The ssh_host private key file is more recent than any other file
Expand All @@ -44,9 +45,11 @@
expect(root1.system_name).to eq "Operating system 1"
end

it "uses 'Linux' as name for systems without /etc/os-release" do
it "uses 'Linux' as name for systems without /etc/os-release file" do
root2 = described_class.from_dir(root2_dir)
expect(root2.system_name).to eq _("Linux")
root4 = described_class.from_dir(root4_dir)
expect(root4.system_name).to eq _("Linux")
end

it "uses name and version when PRETTY_NAME is missing in /etc/os-release" do
Expand Down

0 comments on commit 61fff46

Please sign in to comment.