← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1463373] [NEW] cc_apt_configure does not work with python3

 

Public bug reported:

The way cc_apt_configure.py writes out the script to fetch GPG keys
breaks when using Python 3.

* There's a constant, http://bazaar.launchpad.net/~cloud-init-dev/cloud-
init/trunk/view/head:/cloudinit/config/cc_apt_configure.py#L39 that
contains the script.

* In getkeybyid, it's written to a temporary file:
http://bazaar.launchpad.net/~cloud-init-dev/cloud-
init/trunk/view/head:/cloudinit/config/cc_apt_configure.py#L113

Python 3 throws an exception: 'str' does not support the buffer
interface when doing the write.

A very simple example:

import tempfile

fh = tempfile.NamedTemporaryFile()
TEST_STR = """ HELLO WORLD """
fh.write(TEST_STR)

Will work with 2, but not 3.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1463373

Title:
  cc_apt_configure does not work with python3

Status in Init scripts for use on cloud images:
  New

Bug description:
  The way cc_apt_configure.py writes out the script to fetch GPG keys
  breaks when using Python 3.

  * There's a constant, http://bazaar.launchpad.net/~cloud-init-dev
  /cloud-init/trunk/view/head:/cloudinit/config/cc_apt_configure.py#L39
  that contains the script.

  * In getkeybyid, it's written to a temporary file:
  http://bazaar.launchpad.net/~cloud-init-dev/cloud-
  init/trunk/view/head:/cloudinit/config/cc_apt_configure.py#L113

  Python 3 throws an exception: 'str' does not support the buffer
  interface when doing the write.

  A very simple example:

  import tempfile

  fh = tempfile.NamedTemporaryFile()
  TEST_STR = """ HELLO WORLD """
  fh.write(TEST_STR)

  Will work with 2, but not 3.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1463373/+subscriptions


Follow ups

References