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 #15286: Remove standard ncf post-hooks #1998

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
3 changes: 0 additions & 3 deletions rudder-webapp/SOURCES/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ install: build initial-promises initial-ncf
mkdir -p $(DESTDIR)/opt/rudder/share/package-scripts/
mkdir -p $(DESTDIR)/var/rudder/inventories/received
mkdir -p $(DESTDIR)/var/rudder/inventories/failed
mkdir -p $(DESTDIR)/var/rudder/configuration-repository/ncf/ncf-hooks.d
mkdir -p $(DESTDIR)/var/rudder/run
mkdir -p $(DESTDIR)/var/rudder/ldap/openldap-data
mkdir -p $(DESTDIR)/var/log/rudder/apache2/
Expand Down Expand Up @@ -250,8 +249,6 @@ install: build initial-promises initial-ncf
install -m 644 rudder-web $(DESTDIR)/opt/rudder/etc/server-roles.d/
install -m 640 rudder-passwords.conf $(DESTDIR)/opt/rudder/etc/

install -m 755 post.write_technique.10_commit.sh $(DESTDIR)/var/rudder/configuration-repository/ncf/ncf-hooks.d/
install -m 755 post.write_technique.50_rudderify.sh $(DESTDIR)/var/rudder/configuration-repository/ncf/ncf-hooks.d/
# Add rudder-metrics-reporting
install -m 755 rudder-metrics-reporting $(DESTDIR)/opt/rudder/bin/
install -m 644 ca-bundle.crt $(DESTDIR)/opt/rudder/share/certificates/
Expand Down
53 changes: 0 additions & 53 deletions rudder-webapp/SOURCES/post.write_technique.10_commit.sh

This file was deleted.

72 changes: 0 additions & 72 deletions rudder-webapp/SOURCES/post.write_technique.50_rudderify.sh

This file was deleted.

49 changes: 0 additions & 49 deletions rudder-webapp/SOURCES/post.write_technique.90_reload.sh

This file was deleted.

2 changes: 0 additions & 2 deletions rudder-webapp/SOURCES/rudder-fix-repository-permissions
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,5 @@ chmod -R u+rwX,g+rwX /var/rudder/configuration-repository/techniques
## Add setgid to directories so that all files created here belong to the rudder group
find /var/rudder/configuration-repository/.git /var/rudder/configuration-repository/ncf /var/rudder/configuration-repository/techniques -type d -exec chmod g+s "{}" \;

## Add execution permission for ncf-api on pre/post-hooks
chmod -R 2750 /var/rudder/configuration-repository/ncf/ncf-hooks.d
echo " Done"

58 changes: 9 additions & 49 deletions rudder-webapp/SOURCES/rudder-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,18 @@ trap anomaly_handler ERR INT TERM
# - All versions : upgrade system Techniques automatically and reload the Technique library
# - All versions : Check that Rudder database is able to handle backslash
# - All versions : Check for the PostgreSQL version
# - All versions : Commit ncf hooks
# - All versions : Create ncf technique update flag and restart at the end of the script
# - 4.1.17 : Change LDAP attribute ipNetworkNumber -> networkSubnet
# - 4.1.19, 4.3.9: Drop unused index nodeid_idx
# - 4.1.21,4.3.10: Drop contraint rulesgroupjoin_pkey to replace it by an index
# - 4.2.6,4.3.2 : Create nodecompliancelevels table
# - 4.2.6,4.3.2 : Add new property rudder.batch.reportscleaner.compliancelevels.delete.TTL
# - 4.2.0 : Rename hooks to have a better ordering of hooks
# - 4.2.4, 4.3.0 : Remove 90-reload hook since logic was integrated to Rudder in #11749
# - 4.3 : Update ncf Techniques to the new format
# - 4.3.7 : Drop tables expectedreports and expectesreportsnodes on upgrade
# - 5.0 : Automatically upgrade Techniques if autoupdate-technique-library is set
# - 5.0.7 : Tune autovacuum on a table basis
# - 5.0.12 : Change indexes on RudderSysEvents table
# - 5.1.0 : Remove ncf hooks
####################################################################################

# Some paths
Expand Down Expand Up @@ -349,41 +347,6 @@ upgrade_ncf() {
chmod -R o-rwx ${CONFIGURATION_REPOSITORY}/ncf/50_techniques/
fi

# 4.2.0: Rename hooks to have a better ordering of hooks
CURRENT="$(pwd)"
cd ${CONFIGURATION_REPOSITORY}/ncf
for hook_file in commit.sh rudderify.sh; do
hook=ncf-hooks.d/post.write_technique.${hook_file}
if [ -f ${hook} ]; then
git ls-files --error-unmatch ${hook} >/dev/null 2>&1
MANAGED_BY_GIT=$?
if [ ${MANAGED_BY_GIT} -eq 0 ]; then
git rm ${hook}
git commit -m "Remove technique editor hook \"${hook}\""
else
rm ${hook}
fi
fi
done
cd ${CURRENT}

# 4.2.4, 4.3.0: Remove 90-reload hook since logic was integrated to Rudder in #11749
CURRENT="$(pwd)"
cd ${CONFIGURATION_REPOSITORY}/ncf
for hook_file in 90_reload.sh; do
hook=ncf-hooks.d/post.write_technique.${hook_file}
if [ -f ${hook} ]; then
git ls-files --error-unmatch ${hook} >/dev/null 2>&1
MANAGED_BY_GIT=$?
if [ ${MANAGED_BY_GIT} -eq 0 ]; then
git rm ${hook}
git commit -m "Remove technique editor hook \"${hook}\""
else
rm ${hook}
fi
fi
done
cd ${CURRENT}

# 5.1.0: Remove ncf.conf file
if [ -f ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf ]; then
Expand All @@ -394,17 +357,14 @@ upgrade_ncf() {
cd ${current_path}
fi

# All Versions, Commit ncf hooks
CURRENT="$(pwd)"
cd ${CONFIGURATION_REPOSITORY}/ncf
for hook_file in 10_commit.sh 50_rudderify.sh; do
hook=ncf-hooks.d/post.write_technique.${hook_file}
if [ -f ${hook} ]; then
git add ${hook}
git commit -m "Update technique editor hook \"${hook}\"" --allow-empty
fi
done
cd ${CURRENT}
# 5.1.0: Remove ncf hooks directory
if [ -d ${CONFIGURATION_REPOSITORY}/ncf/ncf-hooks.d ]; then
CURRENT="$(pwd)"
cd ${CONFIGURATION_REPOSITORY}/ncf
git rm -f ncf-hooks.d
git commit --allow-empty -m "Remove ncf-hooks.d from configuration repository"
cd ${CURRENT}
fi

# All Versions: Touch ncf_update_flag_file jetty will be restarted at the end of the script
touch /opt/rudder/etc/force_ncf_technique_update
Expand Down
6 changes: 0 additions & 6 deletions rudder-webapp/SOURCES/rudder-webapp-postinst
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ fi
# Adjust permissions on /var/rudder/configuration-repository
/opt/rudder/bin/rudder-fix-repository-permissions

## Add pre/post-hooks
cd /var/rudder/configuration-repository/ncf/
git add ncf-hooks.d
git commit --allow-empty --message "Add ncf hooks to repository"


if [ -f /tmp/rudder-plugins-upgrade ]
then
/opt/rudder/bin/rudder-pkg plugin restore-status < /tmp/rudder-plugins-upgrade
Expand Down
1 change: 0 additions & 1 deletion rudder-webapp/SPECS/rudder-webapp.spec
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ rm -rf %{buildroot}
/var/rudder/inventories/received
/var/rudder/inventories/failed
/var/rudder/configuration-repository/.gitignore
/var/rudder/configuration-repository/ncf/ncf-hooks.d
/var/log/rudder/ldap
/var/log/rudder/apache2/
/var/log/rudder/webapp/
Expand Down