Support unicode in file.recurse

This commit is contained in:
Lendar 2015-04-06 03:07:44 +03:00
parent 19e0d7a322
commit 21e333c7ba
5 changed files with 7 additions and 7 deletions

View File

@ -64,7 +64,7 @@ class Client(object):
Make sure that this path is intended for the salt master and trim it
'''
if not path.startswith('salt://'):
raise MinionError('Unsupported path: {0}'.format(path))
raise MinionError(u'Unsupported path: {0}'.format(path))
return path[7:]
def _file_local_list(self, dest):

View File

@ -196,7 +196,7 @@ def file_hash(load, fnd):
cache_path = os.path.join(__opts__['cachedir'],
'roots/hash',
load['saltenv'],
'{0}.hash.{1}'.format(fnd['rel'],
u'{0}.hash.{1}'.format(fnd['rel'],
__opts__['hash_type']))
# if we have a cache, serve that if the mtime hasn't changed
if os.path.exists(cache_path):

View File

@ -328,7 +328,7 @@ def cache_file(path, saltenv='base', env=None):
_mk_client()
if path.startswith('salt://|'):
# Strip pipe. Windows doesn't allow pipes in filenames
path = 'salt://{0}'.format(path[8:])
path = u'salt://{0}'.format(path[8:])
env_splitter = '?saltenv='
if '?env=' in path:
salt.utils.warn_until(

View File

@ -3488,7 +3488,7 @@ def manage_file(name,
ret['comment'] = 'File {0} updated'.format(name)
elif not ret['changes'] and ret['result']:
ret['comment'] = 'File {0} is in the correct state'.format(name)
ret['comment'] = u'File {0} is in the correct state'.format(name)
if sfn:
__clean_tmp(sfn)
return ret

View File

@ -2148,7 +2148,7 @@ def recurse(name,
ret['changes'][path] = _ret['changes']
def manage_file(path, source):
source = '{0}|{1}'.format(source[:7], source[7:])
source = u'{0}|{1}'.format(source[:7], source[7:])
if clean and os.path.exists(path) and os.path.isdir(path):
_ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
if __opts__['test']:
@ -2303,7 +2303,7 @@ def recurse(name,
manage_directory(dirname)
vdir.add(dirname)
src = 'salt://{0}'.format(fn_)
src = u'salt://{0}'.format(fn_)
manage_file(dest, src)
if include_empty:
@ -2343,7 +2343,7 @@ def recurse(name,
# Flatten comments until salt command line client learns
# to display structured comments in a readable fashion
ret['comment'] = '\n'.join('\n#### {0} ####\n{1}'.format(
ret['comment'] = '\n'.join(u'\n#### {0} ####\n{1}'.format(
k, v if isinstance(v, string_types) else '\n'.join(v)
) for (k, v) in six.iteritems(ret['comment'])).strip()