diff --git a/conductor/commands/cloud_formation.py b/conductor/commands/cloud_formation.py index 23cddab..2aba89b 100644 --- a/conductor/commands/cloud_formation.py +++ b/conductor/commands/cloud_formation.py @@ -59,8 +59,8 @@ class HeatExecutor(CommandBase): if command == 'CreateOrUpdate': return self._execute_create_update( kwargs['template'], - kwargs.get('mappings') or {}, - kwargs.get('arguments') or {}, + conductor.helpers.str2unicode(kwargs.get('mappings') or {}), + conductor.helpers.str2unicode(kwargs.get('arguments') or {}), callback) elif command == 'Delete': return self._execute_delete(callback) diff --git a/conductor/helpers.py b/conductor/helpers.py index 0e0b7b9..b5cdc72 100644 --- a/conductor/helpers.py +++ b/conductor/helpers.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import types import deep +import types def transform_json(json, mappings): @@ -87,3 +87,16 @@ def find(f, seq): return item, index index += 1 return None, -1 + + +def str2unicode(obj): + if isinstance(obj, str): + return unicode(obj) + elif isinstance(obj, types.DictionaryType): + result = {} + for key, value in obj.items(): + result[str2unicode(key)] = str2unicode(value) + return result + elif isinstance(obj, types.ListType): + return [str2unicode(t) for t in obj] + return obj