You have been subscribed to a public bug:

Cloud-init's conversion of user-data to mime fails when the user-data is
base64 encoded due to the Python2 to Python3 switch. base64.b64decode in
Python 2 returns a string, whilst Python3 returns a byte stream.

Consider:
      import base64

      hi = "aGkK"
      print(type(base64.b64decode(hi)).__name__)
      if 'hi' in str(base64.b64decode(hi)):
         print("works")
      if 'hi' in base64.b64decode(hi):
         print("works on Py2")

ben@prongs:~$ python /tmp/proof.py 
str
works
works on Py2
ben@prongs:~$ python3 /tmp/proof.py 
bytes
works
Traceback (most recent call last):
  File "/tmp/proof.py", line 10, in <module>
    if 'hi' in base64.b64decode(hi):
TypeError: Type str doesn't support the buffer API

** Affects: cloud-init
     Importance: High
     Assignee: Ben Howard (utlemming)
         Status: Fix Committed

** Affects: cloud-init (Ubuntu)
     Importance: Critical
     Assignee: Ben Howard (utlemming)
         Status: In Progress


** Tags: apport-collected bot-comment patch uec-images vivid
-- 
cloud-init user-data mime conversion fails on base64 encoded data
https://bugs.launchpad.net/bugs/1423972
You received this bug notification because you are a member of Ubuntu Server 
Team, which is subscribed to cloud-init in Ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to