From 5a2f6a14cf8e5a491c4bbb68bff1d670cb3f1ff9 Mon Sep 17 00:00:00 2001 From: "matt.d" Date: Wed, 20 Sep 2023 15:37:44 -0700 Subject: [PATCH] Fix regex for DCQCN - skip task if regex does not match - won't fail if the regex doesn't match now --- .../configure_dcqcn/tasks/configure_dcqcn.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/roles/configure_dcqcn/tasks/configure_dcqcn.yml b/roles/configure_dcqcn/tasks/configure_dcqcn.yml index 055722fe..e206fef7 100644 --- a/roles/configure_dcqcn/tasks/configure_dcqcn.yml +++ b/roles/configure_dcqcn/tasks/configure_dcqcn.yml @@ -44,8 +44,10 @@ loop_control: label: "{{ item.item.ibdev }}" vars: - found_setting: "{{ item.stdout | regex_search('ROCE_CC_PRIO_MASK_P1 +([^ ]+)','\\1') | first }}" - when: found_setting != dcqcn_roce_cc_prio_mask_p1 | string + mlx_re: 'ROCE_CC_PRIO_MASK_P1 +([^ ]+)' + when: + - item.stdout is regex(mlx_re) + - item.stdout | regex_search(mlx_re,'\\1') | first != dcqcn_roce_cc_prio_mask_p1 | string notify: Reboot system - dcqcn become: true @@ -55,8 +57,10 @@ loop_control: label: "{{ item.item.ibdev }}" vars: - found_setting: "{{ item.stdout | regex_search('CNP_DSCP_P1 +([^ ]+)','\\1') | first }}" - when: found_setting != dcqcn_cnp_dscp_p1 | string + mlx_re: 'CNP_DSCP_P1 +([^ ]+)' + when: + - item.stdout is regex(mlx_re) + - item.stdout | regex_search(mlx_re,'\\1') | first != dcqcn_cnp_dscp_p1 | string notify: Reboot system - dcqcn become: true @@ -66,8 +70,10 @@ loop_control: label: "{{ item.item.ibdev }}" vars: - found_setting: "{{ item.stdout | regex_search('CNP_802P_PRIO_P1 +([^ ]+)','\\1') | first }}" - when: found_setting != dcqcn_cnp_802p_prio_p1 | string + mlx_re: 'CNP_802P_PRIO_P1 +([^ ]+)' + when: + - item.stdout is regex(mlx_re) + - item.stdout | regex_search(mlx_re,'\\1') | first != dcqcn_cnp_802p_prio_p1 | string notify: Reboot system - dcqcn become: true