← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~harlowja/cloud-init/escape-fixings into lp:cloud-init

 

Joshua Harlow has proposed merging lp:~harlowja/cloud-init/escape-fixings into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1075756 in cloud-init: "String escape not unicode"
  https://bugs.launchpad.net/cloud-init/+bug/1075756

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/escape-fixings/+merge/133149
-- 
https://code.launchpad.net/~harlowja/cloud-init/escape-fixings/+merge/133149
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/escape-fixings into lp:cloud-init.
=== modified file 'cloudinit/handlers/__init__.py'
--- cloudinit/handlers/__init__.py	2012-08-22 18:12:32 +0000
+++ cloudinit/handlers/__init__.py	2012-11-06 22:16:21 +0000
@@ -171,7 +171,11 @@
     elif payload:
         # Extract the first line or 24 bytes for displaying in the log
         start = _extract_first_or_bytes(payload, 24)
-        details = "'%s...'" % (start.encode("string-escape"))
+        try:
+            details = "'%s...'" % (start.encode("string-escape"))
+        except TypeError:
+            # Unicode doesn't support string-escape...
+            details = "'%s...'" % (start)
         if ctype == NOT_MULTIPART_TYPE:
             LOG.warning("Unhandled non-multipart (%s) userdata: %s",
                         ctype, details)


Follow ups