1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minio_ynh.git synced 2024-09-03 19:46:18 +02:00

Prevent mistake if no buckets to migrate

This commit is contained in:
Limezy 2023-01-28 14:22:34 +07:00
parent 67eee565d1
commit 19962cea4b

View file

@ -161,20 +161,25 @@ then
ynh_script_progression --message="Migration from Filesystem to Single-Node Single-Drive mode" ynh_script_progression --message="Migration from Filesystem to Single-Node Single-Drive mode"
pushd $datadir pushd $datadir
for d in * ; do for d in * ; do
ynh_script_progression --message="Migrating bucket $d" if [ "$d" == "*" ]
mv "$d" "DATA_$d" then
pushd $mc_path ynh_script_progression --message="No buckets to migrate"
ynh_exec_warn_less sudo -u $app ./mc mb minio/"$d" else
ynh_exec_warn_less sudo -u $app ./mc mirror --preserve "$datadir/DATA_$d" minio/"$d" ynh_script_progression --message="Migrating bucket $d"
# This is a hack, but it will make outline_ynh users' lifes much easier ! mv "$d" "DATA_$d"
if [ "$d" == "outlinestorage" ] pushd $mc_path
then ynh_exec_warn_less sudo -u $app ./mc mb minio/"$d"
ynh_exec_warn_less sudo -u $app ./mc policy set public minio/outlinestorage ynh_exec_warn_less sudo -u $app ./mc mirror --preserve "$datadir/DATA_$d" minio/"$d"
else # This is a hack, but it will make outline_ynh users' lifes much easier !
ynh_script_progression --message="Bucket is migrated and objects are now mirrored. However, make sure to set properly access policy of bucket $d. That part of the migration can't be automated, sorry ! You can log into the minio console to perform your changes." if [ "$d" == "outlinestorage" ]
fi then
popd ynh_exec_warn_less sudo -u $app ./mc policy set public minio/outlinestorage
ynh_secure_remove --file="DATA_$d" else
ynh_script_progression --message="Bucket is migrated and objects are now mirrored. However, make sure to set properly access policy of bucket $d. That part of the migration can't be automated, sorry ! You can log into the minio console to perform your changes."
fi
popd
ynh_secure_remove --file="DATA_$d"
fi
done done
popd popd
else else