diff options
author | Daniel Watkins <daniel.watkins@canonical.com> | 2015-05-08 13:16:44 +0100 |
---|---|---|
committer | Daniel Watkins <daniel.watkins@canonical.com> | 2015-05-08 13:16:44 +0100 |
commit | 9c7643c4a0dee7843963709c361b755baf843a4b (patch) | |
tree | 3d7c1ec3cbe567fb647ffb0da4b483faccbc8f7a /cloudinit | |
parent | b9f26689e8b3bb7a3486771c6362107232a7dcf4 (diff) | |
download | vyos-cloud-init-9c7643c4a0dee7843963709c361b755baf843a4b.tar.gz vyos-cloud-init-9c7643c4a0dee7843963709c361b755baf843a4b.zip |
Stop using Python 3 only tempfile.TemporaryDirectory (but lose free cleanup).
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/sources/helpers/azure.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py index 60f116e0..cb13187f 100644 --- a/cloudinit/sources/helpers/azure.py +++ b/cloudinit/sources/helpers/azure.py @@ -104,7 +104,7 @@ class OpenSSLManager(object): } def __init__(self): - self.tmpdir = tempfile.TemporaryDirectory() + self.tmpdir = tempfile.mkdtemp() self.certificate = None self.generate_certificate() @@ -113,7 +113,7 @@ class OpenSSLManager(object): if self.certificate is not None: LOG.debug('Certificate already generated.') return - with cd(self.tmpdir.name): + with cd(self.tmpdir): util.subp([ 'openssl', 'req', '-x509', '-nodes', '-subj', '/CN=LinuxTransport', '-days', '32768', '-newkey', 'rsa:2048', @@ -139,7 +139,7 @@ class OpenSSLManager(object): b'', certificates_content.encode('utf-8'), ] - with cd(self.tmpdir.name): + with cd(self.tmpdir): with open('Certificates.p7m', 'wb') as f: f.write(b'\n'.join(lines)) out, _ = util.subp( @@ -159,7 +159,7 @@ class OpenSSLManager(object): current = [] keys = [] for certificate in certificates: - with cd(self.tmpdir.name): + with cd(self.tmpdir): public_key, _ = util.subp( 'openssl x509 -noout -pubkey |' 'ssh-keygen -i -m PKCS8 -f /dev/stdin', |