Skip to content

Conversation

@fank
Copy link

@fank fank commented Nov 8, 2025

Summary

Fixes a bug in the Vultr cloud provider role that prevented server provisioning due to incorrect region data formatting.

Problem

The "Format regions" task was converting region dictionaries to strings using {{ v }} in a Jinja2 loop. This caused the subsequent sort(attribute='country') operation to fail with:

Error while resolving value for 'vultr_regions': object of type 'str' has no attribute 'country'

Solution

Changed the task to directly assign the regions array from the Vultr API response, preserving the dictionary objects with their country, city, id, and other attributes.

Before:

regions: >-
  [ {% for v in _vultr_regions.json['regions'] %}
  {{ v }}{% if not loop.last %},{% endif %}
  {% endfor %} ]

After:

regions: "{{ _vultr_regions.json['regions'] }}"

Testing

  • ✅ Verified that Vultr region selection works correctly
  • ✅ Regions are properly sorted by country
  • ✅ All region attributes are preserved and accessible

Impact

  • Fixes Vultr region selection which was completely broken
  • No changes to other cloud providers
  • Simplifies the code by removing unnecessary Jinja2 loop

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.
@fank fank requested a review from jackivanov as a code owner November 8, 2025 08:56
@CLAassistant
Copy link

CLAassistant commented Nov 8, 2025

CLA assistant check
All committers have signed the CLA.

@fank fank force-pushed the fix/vultr-regions-string-conversion branch from e657c94 to e2bb190 Compare November 8, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants