Skip to content

Commit

Permalink
Cleanup and remove systemd use in the setup scripts
Browse files Browse the repository at this point in the history
Remove unused code in the setup scripts in order to ease refactoring
them. This commit removes the need for systemd running as PID1 to run
the setup script.

This also means that mgr-setup has to be called before running the real
container and starting everything.

Note that some of the cleanup removing non-SUSE distributions handling,
which shouldn't be a problem as Uyuni is now only shipped as a container
built on a single openSUSE distro.
  • Loading branch information
cbosdo committed Nov 27, 2024
1 parent 38062db commit cfb6ca8
Show file tree
Hide file tree
Showing 33 changed files with 108 additions and 2,323 deletions.
5 changes: 5 additions & 0 deletions containers/server-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ RUN zypper --gpg-auto-import-keys --non-interactive install --auto-agree-with-li
${EXTRAPACKAGES} \
${PRODUCT_PATTERN_PREFIX}_server \
${PRODUCT_PATTERN_PREFIX}_retail \
spacewalk-backend-sql-postgresql \
spacewalk-java-postgresql \
postgresql16-contrib \
postgresql16-server \
postgresql16 \
billing-data-service \
grub2-x86_64-efi \
grub2-arm64-efi \
Expand Down
2 changes: 0 additions & 2 deletions projects/perl-Satcon/bin/satcon-deploy-tree.pl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ sub process_file {
my $apache_group = getgrnam(`grep -hsoP "(?<=Group ).*" /etc/httpd/conf/*.conf /etc/apache2/*.conf | tr -d '\n'`);
chown 0, $apache_group, "$destdir/$relative_path";

system '/sbin/restorecon', '-vv', "$destdir/$relative_path";

while (<IF>) {
my $out = $engine->perform_substitutions($_);
print OF $out;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove useless selinux-related code
1 change: 0 additions & 1 deletion rel-eng/packages/spacewalk-setup-postgresql

This file was deleted.

5 changes: 1 addition & 4 deletions schema/spacewalk/spacewalk-schema-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ elsif($server_version > $MAX_PG_DB_VERSION) {
exit 1;
}

my $my_schema_version_out = `rpm -qf --qf '%{name} %{version} %{release}\n' $SCHEMA_DIR/schema-override 2> /dev/null`;
if ($?) { # the directory does not exists or is not owned by any rpm
$my_schema_version_out = `rpm -qf --qf '%{name} %{version} %{release}\n' $SCHEMA_DIR/main.sql`;
}
my $my_schema_version_out = `rpm -qf --qf '%{name} %{version} %{release}\n' $SCHEMA_DIR/main.sql`;
my ($my_schema_name, $my_schema_version, $my_schema_release) = ($my_schema_version_out =~ /^(\S+)\s(\S+)\s(\S+)$/);
if (not defined $my_schema_release) {
die "Failed to retrieve our schema package name and version.\n";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Clean up code related to unused schema-override
1 change: 0 additions & 1 deletion spacewalk/admin/Makefile.admin
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ CONF_DEST = $(PREFIX)/$(CONFDIR)
SYSTEMD_DEST = $(PREFIX)/$(SYSTEMDDIR)

SCRIPTS = rhn-config-satellite.pl \
rhn-config-schema.pl \
rhn-deploy-ca-cert.pl \
rhn-install-ssl-cert.pl \
salt-secrets-config.py
Expand Down
192 changes: 0 additions & 192 deletions spacewalk/admin/rhn-config-schema.pl

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove useless selinux and oracle related code
3 changes: 0 additions & 3 deletions spacewalk/admin/spacewalk-admin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ sed -i 's/apache2.service/httpd.service/g' uyuni-check-database.service
make -f Makefile.admin install PREFIX=%{buildroot}

mkdir -p %{buildroot}%{_mandir}/man8/
%{_bindir}/pod2man --section=8 rhn-config-schema.pl > %{buildroot}%{_mandir}/man8/rhn-config-schema.pl.8
%{_bindir}/pod2man --section=8 man/spacewalk-service.pod > %{buildroot}%{_mandir}/man8/spacewalk-service.8
%{_bindir}/pod2man --section=8 man/rhn-sat-restart-silent.pod > %{buildroot}%{_mandir}/man8/rhn-sat-restart-silent.8
%{_bindir}/pod2man --section=8 rhn-config-satellite.pl > %{buildroot}%{_mandir}/man8/rhn-config-satellite.pl.8
Expand All @@ -81,13 +80,11 @@ fi
%{_sbindir}/uyuni-update-config
%{_sbindir}/import-suma-build-keys
%{_bindir}/rhn-config-satellite.pl
%{_bindir}/rhn-config-schema.pl
%{_bindir}/rhn-deploy-ca-cert.pl
%{_bindir}/rhn-install-ssl-cert.pl
%{_bindir}/salt-secrets-config.py
%{_sbindir}/rhn-sat-restart-silent
%{_sbindir}/mgr-monitoring-ctl
%{_mandir}/man8/rhn-config-schema.pl.8*
%{_mandir}/man8/spacewalk-service.8*
%{_mandir}/man8/rhn-sat-restart-silent.8*
%{_mandir}/man8/rhn-config-satellite.pl.8*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Remove the spacewalk-postgresql package
52 changes: 0 additions & 52 deletions spacewalk/package/spacewalk.spec
Original file line number Diff line number Diff line change
Expand Up @@ -95,55 +95,14 @@ Provides: weakremover(spacewalk-setup-jabberd)
Spacewalk is a systems management application that will
inventory, provision, update and control your Linux machines.

%package postgresql
Summary: Spacewalk Systems Management Application with PostgreSQL database backend
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Applications/Internet
Requires: spacewalk-common = %{version}-%{release}
Conflicts: spacewalk-oracle
Provides: spacewalk-db-virtual = %{version}-%{release}

Requires: spacewalk-backend-sql-postgresql
Requires: spacewalk-java-postgresql
Requires: perl(DBD::Pg)
%if 0%{?suse_version}
# Actual version set by prjconf, default is 14
%{!?postgresql_version_min: %global postgresql_version_min 14}
%{!?postgresql_version_max: %global postgresql_version_max 15}
Requires: postgresql-contrib-implementation >= %{postgresql_version_min}
Requires: postgresql-implementation >= %{postgresql_version_min}
Conflicts: postgresql-contrib-implementation > %{postgresql_version_max}
Conflicts: postgresql-implementation > %{postgresql_version_max}
%else # not a supported SUSE version or alternative OS.
Requires: postgresql14
Requires: postgresql14-contrib
# we do not support postgresql versions > 14.x yet
# Hardcoded v15 conflict due to PostgreSQL bug 17507 (instead of >= 15)
Conflicts: postgresql15
Conflicts: postgresql15-contrib
%endif # if sle_Version

%description postgresql
Spacewalk is a systems management application that will
inventory, provision, update and control your Linux machines.
Version for PostgreSQL database backend.

%prep
%setup -q

%build
#nothing to do here

%install
RDBMS="postgresql"
install -d %{buildroot}%{_sysconfdir}
install -d %{buildroot}%{_datadir}/spacewalk/setup/defaults.d
for i in ${RDBMS} ; do
cat <<EOF >%{buildroot}%{_datadir}/spacewalk/setup/defaults.d/$i-backend.conf
# database backend to be used by spacewalk
db-backend = $i
EOF
done
install -d %{buildroot}%{_bindir}
%if 0%{?rhel}
ln -s %{_prefix}/pgsql-14/bin/initdb %{buildroot}%{_bindir}/initdb
Expand All @@ -152,16 +111,5 @@ ln -s %{_prefix}/pgsql-14/bin/initdb %{buildroot}%{_bindir}/initdb
%files common
%{!?_licensedir:%global license %doc}
%license LICENSE
%if 0%{?suse_version}
%dir %{_datadir}/spacewalk
%dir %{_datadir}/spacewalk/setup
%dir %{_datadir}/spacewalk/setup/defaults.d
%endif

%files postgresql
%{_datadir}/spacewalk/setup/defaults.d/postgresql-backend.conf
%if 0%{?rhel}
%{_bindir}/initdb
%endif

%changelog
1 change: 0 additions & 1 deletion spacewalk/setup/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ WriteMakefile(
ABSTRACT_FROM => 'lib/Spacewalk/Setup.pm',
PL_FILES => {},
EXE_FILES => ['bin/spacewalk-setup',
'bin/spacewalk-make-mount-points',
'bin/spacewalk-setup-cobbler',
'bin/spacewalk-setup-httpd'],
PREREQ_PM => {
Expand Down
Loading

0 comments on commit cfb6ca8

Please sign in to comment.