Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/specinfra/helper/detect_os/suse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def detect
if line =~ /VERSION_ID=\"(\d+\.\d+|\d+)\"/
release = $1
end
{ :family => family, :release => release }
if family
{ :family => family, :release => release }
end
elsif run_command('ls /etc/SuSE-release').success? and run_command('zypper -V').success?
line = run_command('cat /etc/SuSE-release').stdout
if line =~ /SUSE Linux Enterprise Server (\d+)/
Expand Down
6 changes: 6 additions & 0 deletions spec/helper/detect_os/suse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,10 @@
:release => '11.4'
)
end
it 'should not assume the system is SUSE just because zypper is installed' do
allow(suse).to receive(:run_command) {
CommandResult.new(:stdout => "PRETTY_NAME=\"Debian GNU/Linux forky/sid\"\nNAME=\"Debian GNU/Linux\"\nVERSION_CODENAME=forky\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", :exit_status => 0)
}
expect(suse.detect).to be_nil
end
end