From 2b97e9b61bcf6e3f9bab8a9b87ea4c5a5e6bcc6f Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 6 Nov 2025 06:18:18 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Improve=20rege?= =?UTF-8?q?x=20pattern=20for=20extracting=20krb5=20conf=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the regular expression to correctly extract the absolute path of the krb5.conf file from the samba provision output, removing unnecessary quotes and commas. --- tasks/kerberos.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tasks/kerberos.yml b/tasks/kerberos.yml index 5df7d03..09feaa4 100644 --- a/tasks/kerberos.yml +++ b/tasks/kerberos.yml @@ -2,13 +2,18 @@ - name: Extract absolute krb5.conf path from provision output ansible.builtin.set_fact: krb5_conf_path: >- - {{ ( + {{ + ( samba_provision_output.stdout - | regex_findall("(/[^\\s,'\"]+krb5\\.conf)") + | regex_findall('(/[^\\s,"\']*krb5\\.conf)') + | map('regex_replace', "['\",]", '') # remove quotes and commas from matches + | list | default([]) - | first - | default('') - ) | replace(\"'\", '') | replace('\"', '') | replace(',', '') | trim }} + ) + | first + | default('') + | trim + }} when: samba_provision_output.stdout is defined - name: print krb5.conf path