From b60a30cbd4a3b77ad57b6c37833ef78e928a3e7e Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 20 Oct 2017 12:13:44 -0400 Subject: [PATCH] fix a unicode handling bug in inventory source name migration see: https://github.com/ansible/ansible-tower/issues/7740 --- awx/main/migrations/_inventory_source.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/awx/main/migrations/_inventory_source.py b/awx/main/migrations/_inventory_source.py index e2401ee3ae..7534c53fca 100644 --- a/awx/main/migrations/_inventory_source.py +++ b/awx/main/migrations/_inventory_source.py @@ -1,6 +1,7 @@ import logging from django.db.models import Q +import six logger = logging.getLogger('awx.main.migrations') @@ -38,8 +39,10 @@ def rename_inventory_sources(apps, schema_editor): Q(deprecated_group__inventory__organization=org)).distinct().all()): inventory = invsrc.deprecated_group.inventory if invsrc.deprecated_group else invsrc.inventory - name = '{0} - {1} - {2}'.format(invsrc.name, inventory.name, i) - logger.debug("Renaming InventorySource({0}) {1} -> {2}".format(invsrc.pk, invsrc.name, name)) + name = six.text_type('{0} - {1} - {2}').format(invsrc.name, inventory.name, i) + logger.debug(six.text_type("Renaming InventorySource({0}) {1} -> {2}").format( + invsrc.pk, invsrc.name, name + )) invsrc.name = name invsrc.save()