mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Operate on a copy of the read_data
This keeps us from mangling it if it contains lists, which we would be popping items off of. We don't want to pop items from the list that was passed in.
This commit is contained in:
parent
71eeae1240
commit
38df912fa6
1 changed files with 5 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
from __future__ import absolute_import
|
||||
import collections
|
||||
import copy
|
||||
import errno
|
||||
import fnmatch
|
||||
import sys
|
||||
|
@ -331,6 +332,10 @@ class MockOpen(object):
|
|||
objects, representing the individual times that a given file was opened.
|
||||
'''
|
||||
def __init__(self, read_data=''):
|
||||
# If the read_data contains lists, we will be popping it. So, don't
|
||||
# modify the original value passed.
|
||||
read_data = copy.copy(read_data)
|
||||
|
||||
# Normalize read_data, Python 2 filehandles should never produce unicode
|
||||
# types on read.
|
||||
if not isinstance(read_data, dict):
|
||||
|
|
Loading…
Add table
Reference in a new issue