We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
/usr/local/bin/slapd-restore is wrong.
Try to restore a db archive: slapd-restore-data your_db_archive.gz
Data restoration should work.
Sorry, no logs.
I fixed it like this:
#!/usr/bin/with-contenv bash set -x
source /assets/functions/00-container source /assets/defaults/10-openldap
dbnum=$1 file=$2
backupPath="/data/backup" file="$backupPath/$file"
s6-svc -d /var/run/s6/services/10-openldap pkill slapd
sleep 5 ps aux
TEMP_FILE=$(mktemp) gunzip -c $file > $TEMP_FILE chown ldap:ldap $TEMP_FILE
if [ "$1" = "0" ]; then rm -rf ${CONFIG_PATH}/slap.d/* fi
if [ "$1" = "1" ]; then rm -rf ${DB_PATH}/* fi
sudo -u ldap slapadd -c -F /etc/openldap/slapd.d -n $dbnum -l $TEMP_FILE
s6-svc -u /var/run/s6/services/10-openldap
rm $TEMP_FILE
exit 0
The text was updated successfully, but these errors were encountered:
Thanks for this. Fixed in ccb0f83 and tagged as 7.1.17 with credit to you.
7.1.17
Sorry, something went wrong.
No branches or pull requests
Summary
/usr/local/bin/slapd-restore is wrong.
Steps to reproduce
Try to restore a db archive: slapd-restore-data your_db_archive.gz
What is the expected correct behavior?
Data restoration should work.
Relevant logs and/or screenshots
Sorry, no logs.
Environment
Possible fixes
I fixed it like this:
#!/usr/bin/with-contenv bash
set -x
This file overwrite the original slapd-restore that comes with the container
and that is buggy
source /assets/functions/00-container
source /assets/defaults/10-openldap
Usage: /sbin/slapd-restore dbnum file
dbnum=$1
file=$2
backupPath="/data/backup"
file="$backupPath/$file"
stop slapd
s6-svc -d /var/run/s6/services/10-openldap
pkill slapd
sleep 5
ps aux
TEMP_FILE=$(mktemp)
gunzip -c $file > $TEMP_FILE
chown ldap:ldap $TEMP_FILE
if [ "$1" = "0" ]; then
rm -rf ${CONFIG_PATH}/slap.d/*
fi
if [ "$1" = "1" ]; then
rm -rf ${DB_PATH}/*
fi
sudo -u ldap slapadd -c -F /etc/openldap/slapd.d -n $dbnum -l $TEMP_FILE
restart slapd
s6-svc -u /var/run/s6/services/10-openldap
rm $TEMP_FILE
exit 0
The text was updated successfully, but these errors were encountered: