Handle OSError which can be thrown when removing tmpdir. Fixes bug 883326.
Change-Id: Ie1f40fcce6ce6af4ab71961c725dcd626eda8aea
This commit is contained in:
2 changed files with 15 additions and 3 deletions
1
Authors
1
Authors
@@ -29,6 +29,7 @@ Chiradeep Vittal <chiradeep@cloud.com>
Chmouel Boudjnah <chmouel@chmouel.com>
Chris Behrens <cbehrens@codestud.com>
Christian Berendt <berendt@b1-systems.de>
Chris Fattarsi <chris.fattarsi@pistoncloud.com>
Christopher MacGown <chris@pistoncloud.com>
Chuck Short <zulcss@ubuntu.com>
Cole Robinson <crobinso@redhat.com>
@@ -136,7 +136,10 @@ def generate_fingerprint(public_key):
except exception.ProcessExecutionError:
raise exception.InvalidKeypair()
finally:
shutil.rmtree(tmpdir)
try:
shutil.rmtree(tmpdir)
except IOError, e:
LOG.debug(_('Could not remove tmpdir: %s'), str(e))
def generate_key_pair(bits=1024):
@@ -150,7 +153,10 @@ def generate_key_pair(bits=1024):
private_key = open(keyfile).read()
public_key = open(keyfile + '.pub').read()
shutil.rmtree(tmpdir)
try:
shutil.rmtree(tmpdir)
except OSError, e:
LOG.debug(_('Could not remove tmpdir: %s'), str(e))
return (private_key, public_key, fingerprint)
@@ -235,7 +241,12 @@ def generate_x509_cert(user_id, project_id, bits=1024):
'-batch', '-subj', subject)
private_key = open(keyfile).read()
csr = open(csrfile).read()
shutil.rmtree(tmpdir)
try:
shutil.rmtree(tmpdir)
except OSError, e:
LOG.debug(_('Could not remove tmpdir: %s'), str(e))
(serial, signed_csr) = sign_csr(csr, project_id)
fname = os.path.join(ca_folder(project_id), 'newcerts/%s.pem' % serial)
cert = {'user_id': user_id,
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.