Skip to content

Commit e2bb190

Browse files
committed
Fix Vultr regions string conversion bug
The "Format regions" task was converting region dictionaries to strings using {{ v }} in a Jinja2 loop, which caused the subsequent sort() to fail with "object of type 'str' has no attribute 'country'". Changed to directly assign the regions array from the API response, preserving the dictionary objects with their country, city, id, and other attributes. Fixes the error: "object of type 'str' has no attribute 'country'" when provisioning Vultr servers.
1 parent 4c836e1 commit e2bb190

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

roles/cloud-vultr/tasks/prompts.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@
2929

3030
- name: Format regions
3131
set_fact:
32-
regions: >-
33-
[ {% for v in _vultr_regions.json['regions'] %}
34-
{{ v }}{% if not loop.last %},{% endif %}
35-
{% endfor %} ]
32+
regions: "{{ _vultr_regions.json['regions'] }}"
3633

3734
- name: Set regions as a fact
3835
set_fact:

0 commit comments

Comments
 (0)