mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2019.2.1' into yaml_flow_style
This commit is contained in:
commit
9a27fb3f96
2 changed files with 5 additions and 5 deletions
|
@ -308,7 +308,6 @@ import salt.utils.stringutils
|
|||
import salt.utils.templates
|
||||
import salt.utils.url
|
||||
import salt.utils.versions
|
||||
from salt.utils.locales import sdecode
|
||||
from salt.exceptions import CommandExecutionError
|
||||
from salt.serializers import DeserializationError
|
||||
from salt.state import get_accumulator_dir as _get_accumulator_dir
|
||||
|
@ -1176,12 +1175,12 @@ def _get_template_texts(source_list=None,
|
|||
return ret
|
||||
|
||||
|
||||
def _validate_str_list(arg):
|
||||
def _validate_str_list(arg, encoding=None):
|
||||
'''
|
||||
ensure ``arg`` is a list of strings
|
||||
'''
|
||||
if isinstance(arg, six.binary_type):
|
||||
ret = [salt.utils.stringutils.to_unicode(arg)]
|
||||
ret = [salt.utils.stringutils.to_unicode(arg, encoding=encoding)]
|
||||
elif isinstance(arg, six.string_types):
|
||||
ret = [arg]
|
||||
elif isinstance(arg, Iterable) and not isinstance(arg, Mapping):
|
||||
|
@ -2623,7 +2622,7 @@ def managed(name,
|
|||
)
|
||||
|
||||
try:
|
||||
validated_contents = _validate_str_list(use_contents)
|
||||
validated_contents = _validate_str_list(use_contents, encoding=encoding)
|
||||
if not validated_contents:
|
||||
return _error(
|
||||
ret,
|
||||
|
@ -3756,7 +3755,7 @@ def recurse(name,
|
|||
# "env" is not supported; Use "saltenv".
|
||||
kwargs.pop('env')
|
||||
|
||||
name = os.path.expanduser(sdecode(name))
|
||||
name = os.path.expanduser(salt.utils.data.decode(name))
|
||||
|
||||
user = _test_owner(kwargs, user=user)
|
||||
if salt.utils.platform.is_windows():
|
||||
|
|
|
@ -612,6 +612,7 @@ class TestFileState(TestCase, LoaderModuleMockMixin):
|
|||
ret = filestate.managed(
|
||||
filename,
|
||||
contents_pillar='fnord',
|
||||
encoding='utf-8'
|
||||
)
|
||||
actual_contents = mock_manage.call_args[0][14]
|
||||
self.assertEqual(actual_contents, expected_contents)
|
||||
|
|
Loading…
Add table
Reference in a new issue