fix: GCE region selection displays complete names instead of characters#14953
fix: GCE region selection displays complete names instead of characters#14953
Conversation
The Jinja2 template was building a string that looked like a list instead of an actual list. When Ansible iterated over this string, it yielded one character per iteration, causing the region prompt to display: 1. [ 2. ' 3. a ... Now follows the pattern used by other cloud providers (EC2, DigitalOcean, etc.) by storing region objects directly and accessing .name property. Fixes #14944 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR correctly fixes the GCE region selection bug where individual characters were displayed instead of complete region names. The root cause was Jinja2 native mode treating the constructed string as a literal string instead of a list. AnalysisProblem identification (✅ Correct) gce_regions: >-
[{%- for region in gcp_compute_regions_info.resources | sort(attribute='name') -%}
'{{ region.name }}'{% if not loop.last %},{% endif %}
{%- endfor -%}]This resulted in Solution (✅ Correct) gce_regions: "{{ gcp_compute_regions_info.resources | sort(attribute='name') }}"Code QualityFollows established patterns (✅)
Jinja2 native mode compatibility (✅)
Loop conversion (✅)
Testing ObservationsWhat was tested:
Verification needed:
Potential IssuesNone identified. The changes are minimal, focused, and follow the correct pattern. Recommendations
Security ConsiderationsNo security implications - this is a UI/UX fix for region selection prompts. Performance ConsiderationsPerformance impact is negligible - actually slightly better since we're not manually constructing strings. Verdict: ✅ Approved This is a clean, well-scoped fix that solves exactly the reported issue. The changes follow established patterns in the codebase and are compatible with Ansible 12+ requirements. 🤖 Generated with Claude Code |
Summary
"['africa-south1', ...]") instead of an actual listFixes #14944
Test plan
ansible-lint roles/cloud-gce/tasks/prompts.yml && yamllint roles/cloud-gce/tasks/prompts.ymlansible-playbook main.yml --syntax-check🤖 Generated with Claude Code