Revert "Ensure file_tree pillar returns unicode"

This reverts commit 99e4e75c33.
This commit is contained in:
Megan Wilhite 2020-11-10 16:16:54 -05:00 committed by Daniel Wozniak
parent 2e94a57d94
commit 11e2550d7e
3 changed files with 11 additions and 14 deletions

View file

@ -1 +0,0 @@
Ensure file_tree pillar returns unicode.

View file

@ -254,11 +254,9 @@ def _construct_pillar(
whitelist=renderer_whitelist,
)
if salt.utils.stringio.is_readable(data):
pillar_node[file_name] = salt.utils.stringutils.to_unicode(
data.getvalue()
)
pillar_node[file_name] = data.getvalue()
else:
pillar_node[file_name] = salt.utils.stringutils.to_unicode(data)
pillar_node[file_name] = data
return pillar

View file

@ -20,18 +20,18 @@ MINION_ID = "test-host"
NODEGROUP_PATH = os.path.join("nodegroups", "test-group", "files")
HOST_PATH = os.path.join("hosts", MINION_ID, "files")
BASE_PILLAR_CONTENT = {"files": {"hostfile": "base", "groupfile": "base"}}
BASE_PILLAR_CONTENT = {"files": {"hostfile": b"base", "groupfile": b"base"}}
DEV_PILLAR_CONTENT = {
"files": {
"hostfile": "base",
"groupfile": "dev2",
"hostfile1": "dev1",
"groupfile1": "dev1",
"hostfile2": "dev2",
"hostfile": b"base",
"groupfile": b"dev2",
"hostfile1": b"dev1",
"groupfile1": b"dev1",
"hostfile2": b"dev2",
}
}
PARENT_PILLAR_CONTENT = {
"files": {"hostfile": "base", "groupfile": "base", "hostfile2": "dev2"}
"files": {"hostfile": b"base", "groupfile": b"base", "hostfile2": b"dev2"}
}
FILE_DATA = {
@ -153,9 +153,9 @@ class FileTreePillarTestCase(TestCase, LoaderModuleMockMixin):
else:
raise AssertionError("Did not find error message")
def test_file_tree_no_bytes(self):
def test_file_tree_bytes(self):
"""
test file_tree pillar does not return bytes
test file_tree pillar returns bytes
"""
absolute_path = os.path.join(self.pillar_path, "base")
with patch(