1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yunorunner_ynh.git synced 2024-09-03 20:36:13 +02:00

Fix linter, fix cluster now being a boolean

This commit is contained in:
Salamandar 2024-03-15 13:10:46 +01:00
parent 2146effb72
commit 240403cbd3
5 changed files with 20 additions and 5 deletions

View file

@ -14,7 +14,6 @@ maintainers = []
[upstream]
license = "GPL-3.0-or-later"
code = "https://github.com/YunoHost/yunorunner"
website = "https://github.com/YunoHost/yunorunner"
[integration]
yunohost = ">= 11.2"

View file

@ -33,7 +33,7 @@ setup_lxd() {
ynh_print_info "Configuring lxd..."
if [ "$cluster" == "cluster" ]; then
if [ "$cluster" -eq 1 ]; then
setup_lxd
else
lxd init --auto # --storage-backend=dir
@ -45,6 +45,12 @@ setup_lxd() {
ynh_exec_as "$app" lxc remote add yunohost https://devbaseimgs.yunohost.org --public --accept-certificate
}
exposed_ports_if_cluster() {
if [ "$cluster" -eq 1 ]; then
echo "8443"
fi
}
setup_lxd_cluster() {
local free_space=$(df --output=avail / | sed 1d)
local btrfs_size=$(( free_space * 90 / 100 / 1024 / 1024 ))

View file

@ -74,7 +74,7 @@ ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description="$app daemon for YunoRunner"
yunohost service add "$app" --description="$app daemon for YunoRunner" --needs_exposed_ports="$(exposed_ports_if_cluster)"
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"

View file

@ -45,7 +45,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="$app daemon for YunoRunner"
yunohost service add "$app" --description="$app daemon for YunoRunner" --needs_exposed_ports="$(exposed_ports_if_cluster)"
ynh_restore_file --origin_path="/etc/cron.d/$app"

View file

@ -41,6 +41,16 @@ if echo "$context" | grep -- -; then
ynh_app_setting_set --app="$app" --key="context" --value="$context"
fi
# cluster is now a boolean
if [[ "$cluster" == "cluster" ]] || [[ "$cluster" == "no" ]]; then
if [[ "$cluster" == "cluster" ]]; then
cluster=1
else
cluster=0
fi
ynh_app_setting_set --app="$app" --key="cluster" --value="$cluster"
fi
# Remove Pythonz
ynh_secure_remove --file="$install_dir/.pythonz"
@ -89,7 +99,7 @@ ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description="$app daemon for YunoRunner"
yunohost service add "$app" --description="$app daemon for YunoRunner" --needs_exposed_ports="$(exposed_ports_if_cluster)"
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"