Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #26331: Cleanup server package for 8.3 #2968

Open
wants to merge 1 commit into
base: branches/rudder/8.3
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion rudder-server/SOURCES/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ install: build rudder-server-version initial-promises initial-ncf
# Install helper scripts
install -m 755 rudder-init $(DESTDIR)/opt/rudder/bin/
install -m 755 rudder-node-to-relay $(DESTDIR)/opt/rudder/bin/
install -m 755 rudder-reload-cf-serverd $(DESTDIR)/opt/rudder/bin/
install -m 755 split-vhost ${DESTDIR}/opt/rudder/bin/

install -m 644 $(WEB_RESOURCES)/demo-rudder-users.xml $(DESTDIR)/opt/rudder/etc/rudder-users.xml
Expand Down
1 change: 0 additions & 1 deletion rudder-server/SOURCES/rsyslog/rudder-slapd.conf

This file was deleted.

14 changes: 0 additions & 14 deletions rudder-server/SOURCES/rudder-reload-cf-serverd

This file was deleted.

109 changes: 0 additions & 109 deletions rudder-server/SOURCES/rudder-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ trap 'anomaly_handler ${LINENO}' ERR INT TERM
# - All versions : Check that Rudder database is able to handle backslash
# - All versions : Check for the PostgreSQL version
# - All versions : Create ncf technique update flag and restart at the end of the script
# - 6.1.0 : Migrate RudderUniqueID to the template format
# - 6.1.0 : Add indexes cn,softwareVersion,directiveId in slapd.conf
# - 6.1.1 : Update apache conf if it does not contain technique editor conf (file not updated by packaging
# - 6.2.0 : Remove unused index on RudderSysEvents
# - 6.2.0~beta2 : Add software and modifyTimestamp indexes in slapd.conf
# - 7.0.0~alpha1 : Rename property rudder.community.port into rudder.policy.distribution.port.cfengine
# - 7.0.0~beta2 : Change the way compliance is computed - change table ReportsExecution
# - 7.0.0~beta2 : Remove old system techniques
# - 7.0.0~beta2 : Don't show wizard on upgrade
# - 7.0.0~beta2 : Remove name historization tables
# - 7.1.0~beta1 : Replace serial from ruddersysevents table with reportid
# - 7.2.0~alpha1 : Add softwareId index in slapd.conf
# - 7.2.0~alpha1 : Add nodeId index in slapd.conf
# - 7.2.0~beta2 : Add the CampaignEvent table
####################################################################################

# Some paths
Expand Down Expand Up @@ -398,37 +384,10 @@ upgrade_masterfiles() {
fi
}

################################################################################
# Check and update config
################################################################################

upgrade_conf_file() {

STEP="Upgrade /opt/rudder/etc/rudder-web.properties"
CONF_FILE="/opt/rudder/etc/rudder-web.properties"

# - 7.0.0~alpha1 : Rename property rudder.community.port into rudder.policy.distribution.port.cfengine
OLD_PROPERTY_NAME="rudder.community.port"
NEW_PROPERTY_NAME="rudder.policy.distribution.port.cfengine"
ATTRIBUTESET=$(grep -c "^${NEW_PROPERTY_NAME}[ \t]*=" ${CONF_FILE} || true)
if [ ${ATTRIBUTESET} -eq 0 ]; then
sed -i -e "s/${OLD_PROPERTY_NAME}/${NEW_PROPERTY_NAME}/" ${CONF_FILE}
echo "INFO: Configuration property '${OLD_PROPERTY_NAME}' was updated to '${NEW_PROPERTY_NAME}' in /opt/rudder/etc/rudder-web.properties"
fi

}

################################################################################
# Check and update database
################################################################################

# Upgrade the eventlog
# This has been separated from the upgrade_database to be run after, as it would allow to create the indexes for eventlog if necessary
# and have only one location for all the eventlog upgrade part
upgrade_eventlog() {
:
}

# Upgrade the PostgreSQL database
upgrade_database() {
# All versions: Check that Rudder database is able to handle backslash
Expand All @@ -441,46 +400,6 @@ upgrade_database() {
echo " Done"
fi

# Now check the fileFormat in the eventlog
upgrade_eventlog

# - All versions: Check for the PostgreSQL version
STEP="Check for the current PosgresSQL version"

# If coming from an old install (upgraded from centos7 or sles11)
if [ -e /var/lib/pgsql/data/PG_VERSION ]; then
CLUSTER_VERSION=$(cat /var/lib/pgsql/data/PG_VERSION | cut -d . -f 1-2)
if [ `ver ${CLUSTER_VERSION}` -lt `ver 9.2` ]; then
echo "ERROR: Your running PostgreSQL cluster, in version ${CLUSTER_VERSION}, is too old for Rudder 5.0+"
echo "ERROR: Please manually migrate your data to the newer PostgreSQL version installed with Rudder."
fi
fi

RES=$(psql -V|head -1|cut -d " " -f 3|cut -d . -f 1-2)
if [ `ver ${RES}` -lt `ver 9.2` ]; then
echo "ERROR: Your PostgreSQL version, ${RES}, is too old and will fail to work properly with Rudder 5.0+."
echo "ERROR: Please upgrade to at least 9.2."
fi
}

################################################################################
# Check and update ldap web properties
################################################################################

# Upgrade the LDAP web properties
upgrade_ldap_web_properties() {
#Pre 7.0 to 7.0: Don't show wizard at upgrade
LDAP_TEST_PROTOCOL=$(${LDAPSEARCH} -b "ou=Application Properties,cn=rudder-configuration" "propertyName=rudder_setup_done" | grep -c "dn: propertyName=" || true)
if [ ${LDAP_TEST_PROTOCOL} -eq 0 ]; then
${LDAPADD} <<EOF
dn: propertyName=rudder_setup_done,ou=Application Properties,cn=rudder-configuration
objectClass: property
objectClass: top
propertyName: rudder_setup_done
propertyValue: true
EOF
fi

}

################################################################################
Expand All @@ -492,20 +411,6 @@ upgrade_slapdconf() {
SLAPD_CONF="/opt/rudder/etc/openldap/slapd.conf"
NEED_REINDEX=false

# 6.2.0~beta2:
# Add software and modifyTimestamp indexes in slapd.conf
# 7.2.0~alpha1:
# Add softwareId and nodeId index in slapd.conf
for i in "software" "modifyTimestamp" "softwareId" "nodeId"; do
line="index\s*${i}\s*eq"
INDEX_COUNT=$(grep -c "^${line}" ${SLAPD_CONF} 2>/dev/null || true)
if [ ${INDEX_COUNT} -eq 0 ]; then
echo "Adding LDAP index on attribute: ${i}"
sed -i "/index\s*objectClass\s*eq/a index\t${i}\teq" ${SLAPD_CONF}
NEED_REINDEX=true
fi
done

# If user choose to replace configuration file, then /opt/rudder/etc/openldap/slapd.conf
# already contains the index, but nothing reindexed slapd
# We need to check for existence of slapd.conf.dpkg-old, its age, and if it contains index
Expand Down Expand Up @@ -566,7 +471,6 @@ upgrade_plugins() {
################################################################################

update_credentials
upgrade_conf_file
upgrade_slapdconf
set_git_branch
upgrade_system_techniques
Expand All @@ -593,22 +497,9 @@ fi
echo -n "INFO: Upgrading LDAP DB..."
# starting slapd because it is stopped during upgrade
systemctl start rudder-slapd
# Using retry_wrapper is necessary because starting may take a bit of time, so we need to wait
# for it to be available again
if retry_wrapper "${LDAPSEARCH} -b '' -s base + >/dev/null 2>&1" "LDAP";
then
echo " OK"
upgrade_ldap_web_properties
else
echo " ERROR"
INCOMPLETE_MIGRATION=true
fi

upgrade_plugins

# 6.1.5: Flag file /opt/rudder/etc/policy-update-running is not used anymore
rm -f /opt/rudder/etc/policy-update-running || true

################################################################################
# End
################################################################################
Expand Down
1 change: 0 additions & 1 deletion rudder-server/SOURCES/rudder-webapp.fc

This file was deleted.

2 changes: 1 addition & 1 deletion rudder-server/SPECS/rudder-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ make --debug build

%if 0%{?rhel} || 0%{?fedora}
# Build SELinux policy package
# Compiles rudder-webapp.te and rudder-webapp.fc into rudder-webapp.pp
# Compiles rudder-webapp.te into rudder-webapp.pp and rudder-webapp.fc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original comment is correct

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(but ok for the empty file removal)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested with the real makefile, it generates the fc file
maybe it keeps it if it exists

make -f /usr/share/selinux/devel/Makefile
%endif

Expand Down