$ python3 -c 'from cloudinit.config.cc_apt_configure import getkeybyid; import sys; getkeybyid(sys.argv[1], sys.argv[2])' 03683F77 keyserver.ubuntu.com
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_configure.py", line 113, in getkeybyid
fh.write(EXPORT_GPG_KEYID)
File "/usr/lib/python3.4/tempfile.py", line 556, in func_wrapper
return func(*args, **kwargs)
TypeError: 'str' does not support the buffer interface
# get gpg keyid from keyserver
def getkeybyid(keyid, keyserver):
- with util.ExtendedTemporaryFile(suffix='.sh') as fh:
+ with util.ExtendedTemporaryFile(suffix='.sh', mode="w+") as fh: fh.write(EXPORT_GPG_KEYID)
fh.flush()
cmd = ['/bin/sh', fh.name, keyid, keyserver]
recreates easily enough:
$ python3 -c 'from cloudinit. config. cc_apt_ configure import getkeybyid; import sys; getkeybyid( sys.argv[ 1], sys.argv[2])' 03683F77 keyserver. ubuntu. com python3/ dist-packages/ cloudinit/ config/ cc_apt_ configure. py", line 113, in getkeybyid write(EXPORT_ GPG_KEYID) python3. 4/tempfile. py", line 556, in func_wrapper
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/
fh.
File "/usr/lib/
return func(*args, **kwargs)
TypeError: 'str' does not support the buffer interface
Fixes like this: python3/ dist-packages/ && diff -u cloudinit/ config/ cc_apt_ configure. py.dist cloudinit/ config/ cc_apt_ configure. py ) config/ cc_apt_ configure. py.dist 2015-06-15 20:51:09.109033000 +0000 config/ cc_apt_ configure. py 2015-06-15 20:51:16.185033000 +0000
$ ( cd /usr/lib/
--- cloudinit/
+++ cloudinit/
@@ -109,7 +109,7 @@
# get gpg keyid from keyserver mporaryFile( suffix= '.sh') as fh: mporaryFile( suffix= '.sh', mode="w+") as fh:
fh.write( EXPORT_ GPG_KEYID)
def getkeybyid(keyid, keyserver):
- with util.ExtendedTe
+ with util.ExtendedTe
fh.flush()
cmd = ['/bin/sh', fh.name, keyid, keyserver]