From fbf557d13c8d2d4060574eef3a4d2fbe84f4a1ce Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Fri, 23 Jun 2017 12:44:04 +0100 Subject: [PATCH] Use six to correctly handle text in Python 2 and 3 in the Role schema Change-Id: I23a7dab693ff39377ee1e012aec106bc5b7aed0e Closes-Bug: #1700924 --- tripleo_common/utils/roles.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tripleo_common/utils/roles.py b/tripleo_common/utils/roles.py index fcf143e68..c23d1d1cc 100644 --- a/tripleo_common/utils/roles.py +++ b/tripleo_common/utils/roles.py @@ -17,7 +17,9 @@ import os import shutil import yaml +import six from six.moves import cStringIO as StringIO + from tripleo_common.exception import NotFound from tripleo_common.exception import RoleMetadataError @@ -99,15 +101,15 @@ def validate_role_yaml(role_data=None, role_path=None): raise RoleMetadataError('Unable to parse role yaml') schema = { - 'name': {'type': str}, + 'name': {'type': six.string_types}, 'CountDefault': {'type': int}, - 'HostnameFormatDefault': {'type': str}, + 'HostnameFormatDefault': {'type': six.string_types}, 'disable_constraints': {'type': bool}, 'disable_upgrade_deployment': {'type': bool}, 'upgrade_batch_size': {'type': int}, 'ServicesDefault': {'type': list}, 'tags': {'type': list}, - 'description': {'type': str}, + 'description': {'type': six.string_types}, 'networks': {'type': list}, }