From 6a660b490ee6384055d2afb07f8cac1628168ba2 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 5 Apr 2016 20:43:05 -0400 Subject: write_files: fix decompression of content When provided with gzipped data, an exception would be raised because of a conversion to string. This fixes the issue and adds a test for write_files. LP: #1565638 --- cloudinit/config/cc_write_files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cloudinit/config') diff --git a/cloudinit/config/cc_write_files.py b/cloudinit/config/cc_write_files.py index 4b03ea91..351cfc8c 100644 --- a/cloudinit/config/cc_write_files.py +++ b/cloudinit/config/cc_write_files.py @@ -92,10 +92,10 @@ def decode_perms(perm, default, log): def extract_contents(contents, extraction_types): - result = str(contents) + result = contents for t in extraction_types: if t == 'application/x-gzip': - result = util.decomp_gzip(result, quiet=False) + result = util.decomp_gzip(result, quiet=False, decode=False) elif t == 'application/base64': result = base64.b64decode(result) elif t == UNKNOWN_ENC: -- cgit v1.2.3