Skip to content

Commit d487997

Browse files
vakwetuclaude
authored andcommitted
[ci_gen_kustomize_values] Fix 3-run death spiral in edpm-nodeset2-values template
The edpm-nodeset2-values template derives _vm_type by splitting the first node name from the existing values.yaml (e.g. edpm-compute-0 -> compute). It then uses _vm_type to find matching instances (startswith compute2-). This creates a self-poisoning 3-run death spiral: Run 1: nodes have git placeholder names (edpm-compute-0) -> _vm_type=compute -> finds compute2-* instances -> writes real hostnames (edpm-compute2-XXXXX-0) back to values.yaml Run 2: nodes now have real CI hostnames (edpm-compute2-XXXXX-0) -> _vm_type=compute2 -> searches for compute22-* (does not exist) -> instances_names=[] -> writes nodes: null back to values.yaml Run 3: nodes is null (Python None) -> None | default({}) returns None (default only fires for Undefined) -> None.keys() -> CRASH: None has no attribute keys Fix with two changes: 1. Replace | default({}) with explicit None-safe conditional so that an explicit YAML null does not sneak through as Python None. 2. Strip trailing digits from the derived _vm_type so that after run 1 rewrites node names, compute2 strips back to compute and the instance lookup continues to find compute2-* entries correctly on all subsequent runs. Signed-off-by: Ade Lee <alee@redhat.com> Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 15a93c0 commit d487997

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • roles/ci_gen_kustomize_values/templates/multi-namespace/edpm-nodeset2-values

roles/ci_gen_kustomize_values/templates/multi-namespace/edpm-nodeset2-values/values.yaml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{% set _ipv = cifmw_ci_gen_kustomize_values_ip_version_var_mapping %}
44
{% set instances_names = [] %}
55
{% set _original_nodeset = (original_content.data | default({})).nodeset | default({}) %}
6-
{% set _original_nodes = _original_nodeset.nodes | default({}) %}
6+
{% set _original_nodes = _original_nodeset.nodes if _original_nodeset.nodes else {} %}
77
{% set _original_services = _original_nodeset['services'] | default([]) %}
8-
{% set _vm_type = (_original_nodes.keys() | first).split('-')[1] %}
8+
{% set _vm_type = ((_original_nodes.keys() | first).split('-')[1] | regex_replace('\\d+$', '')) if _original_nodes else 'compute' %}
99
{{ '#vmtype: ' ~ _vm_type }}
1010
{% for _inst in cifmw_networking_env_definition.instances.keys() %}
1111
{% if _inst.startswith(_vm_type ~ "2-") %}

0 commit comments

Comments
 (0)