Ubuntu Pastebin

Paste from nturner at Fri, 1 Jul 2016 17:26:54 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/cloudinit/util.py b/cloudinit/util.py
index e5dd61a..7582f31 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -20,6 +20,8 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from StringIO import StringIO
+
 import contextlib
 import copy as obj_copy
 import ctypes
@@ -1193,7 +1195,7 @@ def uniq_list(in_list):

 def load_file(fname, read_cb=None, quiet=False, decode=True):
     LOG.debug("Reading from %s (quiet=%s)", fname, quiet)
-    ofh = six.BytesIO()
+    ofh = StringIO()
     try:
         with open(fname, 'rb') as ifh:
             pipe_in_out(ifh, ofh, chunk_cb=read_cb)
@@ -1204,10 +1206,7 @@ def load_file(fname, read_cb=None, quiet=False, decode=True):
             raise
     contents = ofh.getvalue()
     LOG.debug("Read %s bytes from %s", len(contents), fname)
-    if decode:
-        return decode_binary(contents)
-    else:
-        return contents
+    return contents
 
 
 def get_cmdline():
Download as text