From 6b3c9b95d537c5d75b5b8eb93df0c0879f04dda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20Horv=C3=A1th?= Date: Tue, 30 Jul 2024 19:55:05 +0200 Subject: [PATCH] Change of preview generation default values. (#20) * Change of preview generation default values. According to the [docs](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/previews_configuration.html), some variables are unsupported, while the default of others have changed. * is defined is not used, changing "null" handling Luckily it works as numbers as string are accepted. * check for unused NC variables * this is an app setting, not a system setting * Deprecate nextcloud_preview_system_jpeg_quality, not nextcloud_preview_app_jpeg_quality Ref: https://github.com/mother-of-all-self-hosting/ansible-role-nextcloud/pull/20#discussion_r1686902142 --------- Co-authored-by: Slavi Pantaleev --- defaults/main.yml | 10 +++------- tasks/adjust_config.yml | 26 +++----------------------- tasks/validate_config.yml | 11 +++++++++++ 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 4ed7fa4..cfc166a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -70,13 +70,9 @@ nextcloud_preview_folder_name: "preview-generator" nextcloud_preview_docker_folder: "/{{ nextcloud_preview_folder_name }}" nextcloud_preview_host_folder: "{{ nextcloud_customized_container_src_path }}/{{ nextcloud_preview_folder_name }}" nextcloud_preview_first_run_finished_filename: "finished-first-run.keepit" -nextcloud_preview_squareSizes: "\"64 256 1024 2048\"" -nextcloud_preview_widthSizes: "\"64 256 1024 2048\"" -nextcloud_preview_heightSizes: "\"64 256 1024 2048\"" -nextcloud_preview_preview_max_x: 2048 -nextcloud_preview_preview_max_y: 2048 -nextcloud_preview_system_jpeg_quality: 60 -nextcloud_preview_app_jpeg_quality: "60" +nextcloud_preview_preview_max_x: null +nextcloud_preview_preview_max_y: null +nextcloud_preview_app_jpeg_quality: 80 # nextcloud_container_image_customizations_enabled controls whether a customized Nextcloud image will be built. # diff --git a/tasks/adjust_config.yml b/tasks/adjust_config.yml index af5e228..66ff419 100644 --- a/tasks/adjust_config.yml +++ b/tasks/adjust_config.yml @@ -32,40 +32,20 @@ cmd: |- docker exec --user={{ nextcloud_uid }}:{{ nextcloud_gid }} {{ nextcloud_identifier }}-server php /var/www/html/occ {{ item.appType }} --type={{ item.type }} --value={{ item.value }} -- {{ item.appConfig }} {{ item.configName }} with_items: - - appType: "config:app:set" - appConfig: "previewgenerator" - configName: "squareSizes" - type: string - value: "{{ nextcloud_preview_squareSizes }}" - - appType: "config:app:set" - appConfig: "previewgenerator" - configName: "widthSizes" - type: string - value: "{{ nextcloud_preview_widthSizes }}" - - appType: "config:app:set" - appConfig: "previewgenerator" - configName: "heightSizes" - type: string - value: "{{ nextcloud_preview_heightSizes }}" - appType: "config:system:set" appConfig: "" configName: "preview_max_x" - type: int + type: "string" value: "{{ nextcloud_preview_preview_max_x }}" - appType: "config:system:set" appConfig: "" configName: "preview_max_y" - type: int + type: "string" value: "{{ nextcloud_preview_preview_max_y }}" - - appType: "config:system:set" + - appType: "config:app:set" appConfig: "" configName: "jpeg_quality" type: int - value: "{{ nextcloud_preview_system_jpeg_quality }}" - - appType: "config:app:set" - appConfig: "preview" - configName: "jpeg_quality" - type: string value: "{{ nextcloud_preview_app_jpeg_quality }}" - name: "Check if {{ nextcloud_preview_first_run_finished_filename }} exists" diff --git a/tasks/validate_config.yml b/tasks/validate_config.yml index 8d03b1a..db340f1 100644 --- a/tasks/validate_config.yml +++ b/tasks/validate_config.yml @@ -14,6 +14,17 @@ - nextcloud_database_username - nextcloud_database_password +- name: Fail if deprecated Nextcloud settings are still defined + ansible.builtin.fail: + msg: >- + You need to drop setting (`{{ item }}`) as it is not used anymore in the Nextcloud role. + when: "item in vars" + with_items: + - nextcloud_preview_squareSizes + - nextcloud_preview_widthSizes + - nextcloud_preview_heightSizes + - nextcloud_preview_system_jpeg_quality + - name: (Deprecation) Catch and report renamed Nextcloud variables ansible.builtin.fail: msg: >-