Files
computer-playbook/roles/web-app-nextcloud/tasks/addons/integration_suitecrm_provision.yml
kevinveenbirkenbachandClaude Opus 5 bbf4ca09cc fix(nextcloud): let occ read a credential that starts with a dash
Symfony ArgvInput reads a token beginning with a dash as an option, so passing the secret as a separate token after --value handed occ two tokens and occ reported the option as missing its value. Doorkeeper mints base64url secrets, so roughly one run in 43 produced one starting with a dash and the OpenProject provisioning died with: The "--value" option requires a value.

The equals form is unambiguous: Symfony splits at the first equals sign and takes everything after it as the value. The quote filter replaces the hand-written single quotes and stays shell-safe. Note that shlex leaves a leading-dash value unquoted, so the equals form is what carries the fix, not the quoting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 11:36:58 +02:00

46 lines
1.8 KiB
YAML

---
- name: ⏳ Wait for the SuiteCRM web endpoint
wait_for:
host: "{{ DOCKER_REACH_HOST }}"
port: "{{ lookup('config', 'web-app-suitecrm', 'services.suitecrm.ports.local.http') }}"
delay: 5
timeout: "{{ lookup('timeout', 600) | int }}"
- name: 🔧 Provision SuiteCRM OAuth2 password client (idempotent), capture credentials
ansible.builtin.command:
argv:
- container
- exec
- -i
- -e
- "NC_CLIENT_NAME={{ nextcloud_crm_client_name }}"
- -e
- "NC_CLIENT_SECRET={{ nextcloud_crm_client_secret }}"
- "{{ nextcloud_crm_container }}" # nocheck: container-exec-resolver runs only behind the bare-name partner probe gate, compose co-location
- php
- -d
- error_reporting=E_ERROR
- -
chdir: "{{ nextcloud_crm_instance_dir }}"
stdin: "{{ lookup('file', 'php/addons/suitecrm/provision_oauth_password_client.php') }}"
register: nextcloud_crm_provision
changed_when: false
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: 🔎 Parse the SuiteCRM OAuth client credentials
set_fact:
nextcloud_crm_client_id: "{{ nextcloud_crm_provision.stdout | regex_search('CLIENT_ID=(.+)', '\\1') | first }}"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: 🔗 Link the SuiteCRM OAuth password client into integration_suitecrm
shell: >
{{ NEXTCLOUD_DOCKER_EXEC_OCC }} config:app:set integration_suitecrm {{ item.key }}
--value={{ item.value | quote }}
loop:
- { key: "oauth_instance_url", value: "{{ nextcloud_crm_base_url }}" }
- { key: "client_id", value: "{{ nextcloud_crm_client_id }}" }
- { key: "client_secret", value: "{{ nextcloud_crm_client_secret }}" }
loop_control:
label: "{{ item.key }}"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"