Skip to content

Commit

Permalink
fix: update constraints commands syntax for pcs-0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjelinek authored and richm committed Dec 9, 2024
1 parent 0c0dc2c commit eb3bc2b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
18 changes: 16 additions & 2 deletions tasks/shell_pcs/pcs-cib-constraint-colocation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
27 changes: 24 additions & 3 deletions tasks/shell_pcs/pcs-cib-constraint-location.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 }}
Expand Down

0 comments on commit eb3bc2b

Please sign in to comment.