From 0a7855411cce197ce1e6b455ae02404d62b4b64f Mon Sep 17 00:00:00 2001 From: Tomas Jelinek Date: Thu, 21 Nov 2024 16:46:33 +0100 Subject: [PATCH] fix: update constraints commands syntax for pcs-0.12 --- .../pcs-cib-constraint-colocation.yml | 18 +++++++++++-- .../shell_pcs/pcs-cib-constraint-location.yml | 27 ++++++++++++++++--- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/tasks/shell_pcs/pcs-cib-constraint-colocation.yml b/tasks/shell_pcs/pcs-cib-constraint-colocation.yml index dc864228..251b6595 100644 --- a/tasks/shell_pcs/pcs-cib-constraint-colocation.yml +++ b/tasks/shell_pcs/pcs-cib-constraint-colocation.yml @@ -25,9 +25,23 @@ {% endif %} {{ constraint.resource_leader.id | quote }} {% for option in constraint.options | d([]) if option.name == 'score' %} - {{ option.value | quote }} + {% if + 'pcmk.constraint.colocation.simple.options.score' + in __ha_cluster_pcs_capabilities + %} + {{ ('score=' ~ option.value) | quote }} + {% else %} + {{ option.value | quote }} + {% endif %} {% else %} - INFINITY + {% if + 'pcmk.constraint.colocation.simple.options.score' + in __ha_cluster_pcs_capabilities + %} + score=INFINITY + {% else %} + INFINITY + {% endif %} {% endfor %} {% if constraint.id | d() %} id={{ constraint.id | quote }} diff --git a/tasks/shell_pcs/pcs-cib-constraint-location.yml b/tasks/shell_pcs/pcs-cib-constraint-location.yml index 391e7e54..505d7141 100644 --- a/tasks/shell_pcs/pcs-cib-constraint-location.yml +++ b/tasks/shell_pcs/pcs-cib-constraint-location.yml @@ -25,7 +25,14 @@ {% for option in constraint.options | d([]) %} {{ option.name | quote }}={{ option.value | quote }} {% endfor %} - {{ constraint.rule }} + {% if + 'pcmk.constraint.location.simple.rule.rule-as-one-argument' + in __ha_cluster_pcs_capabilities + %} + {{ constraint.rule | quote }} + {% else %} + {{ constraint.rule }} + {% endif %} {% elif (constraint.id | d()) or ( @@ -42,9 +49,23 @@ {% endif %} {{ constraint.node | quote }} {% for option in constraint.options | d([]) if option.name == 'score' %} - {{ option.value | quote }} + {% if + 'pcmk.constraint.location.simple.options.score' + in __ha_cluster_pcs_capabilities + %} + {{ ('score=' ~ option.value) | quote }} + {% else %} + {{ option.value | quote }} + {% endif %} {% else %} - INFINITY + {% if + 'pcmk.constraint.location.simple.options.score' + in __ha_cluster_pcs_capabilities + %} + score=INFINITY + {% else %} + INFINITY + {% endif %} {% endfor %} {% for option in constraint.options | d([]) if option.name != 'score' %} {{ option.name | quote }}={{ option.value | quote }}