Skip to content

Commit 649dc04

Browse files
Ryan EgesdahlEvergreen Agent
Ryan Egesdahl
authored and
Evergreen Agent
committed
SERVER-55460 Fix RPM packaging and package testing for SLES 12
Some versions of SLES apparently don't define the _sharedstatedir RPM macro properly, leaving it at the old-time UNIX /usr/com default. This was causing the server to fail to start on such platforms because the expected data directory at /var/lib/mongodb was missing. The macro is now statically defined on SLES to /var like it should be on any modern Linux distribution. Also fixed were paths to systemd unit files in package testing and the fact that we weren't installing the tools-extra package, which we should be doing if only to verify that the script indeed continues to fail expectedly on the platform.
1 parent 3042e41 commit 649dc04

10 files changed

+84
-2
lines changed

buildscripts/package_test/recipes/install_mongodb.rb

+6
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@
137137
cwd homedir
138138
end
139139

140+
execute 'install mongo tools' do
141+
command 'zypper --no-gpg-checks -n install `find . -name "*tools-extra*.rpm"`'
142+
live_stream true
143+
cwd homedir
144+
end
145+
140146
execute 'install mongo' do
141147
command 'zypper --no-gpg-checks -n install `find . -name "*shell*.rpm"`'
142148
live_stream true

buildscripts/package_test/test/recipes/service/install_mongodb_spec.rb

+14-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
its('exit_status') { should eq 0 }
5959
its('stderr') { should eq '' }
6060
end
61+
elsif os[:name] == 'suse'
62+
describe command("install_compass") do
63+
its('exit_status') { should eq 1 }
64+
its('stderr') { should match /You are using an unsupported platform/ }
65+
end
6166
else
6267
describe command("install_compass") do
6368
its('exit_status') { should eq 1 }
@@ -67,7 +72,7 @@
6772
else
6873
describe command("install_compass") do
6974
its('exit_status') { should eq 1 }
70-
its('stderr') { should match /Sorry, MongoDB Compass is only supported on 64-bit Intel platforms./ }
75+
its('stderr') { should match /Sorry, MongoDB Compass is only supported on 64-bit Intel platforms/ }
7176
end
7277
end
7378

@@ -120,7 +125,14 @@
120125
end
121126

122127
if systemd
123-
describe file('/lib/systemd/system/mongod.service') do
128+
unit_file_prefix = ''
129+
if os[:name] == 'suse'
130+
# Putting systemd unit files in /usr, which may be a separate partition
131+
# and therefore not available during isolated startups, is bad practice.
132+
# But it's what SUSE has chosen to do, so we have to deal with it.
133+
unit_file_prefix = '/usr'
134+
end
135+
describe file("#{unit_file_prefix}/lib/systemd/system/mongod.service") do
124136
it { should be_file }
125137
end
126138
end

rpm/mongodb-enterprise-init.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-enterprise-unstable-init.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-enterprise-unstable.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-enterprise.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-org-init.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-org-unstable-init.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-org-unstable.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

rpm/mongodb-org.spec

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
%if 0%{?suse_version}
2+
%define _sharedstatedir %{_localstatedir}/lib
3+
%endif
4+
5+
%if ! %{defined _docdir}
6+
%define _docdir %{_datadir}/doc
7+
%endif
8+
19
%if ! %{defined _rundir}
210
%define _rundir %{_localstatedir}/run
311
%endif

0 commit comments

Comments
 (0)