summaryrefslogtreecommitdiff
path: root/nova/crypto.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-06-25 07:38:22 +0000
committerGerrit Code Review <review@openstack.org>2014-06-25 07:38:22 +0000
commit1a6d32b9690b4bff709dc83bcf4c2d3a65fd7c3e (patch)
tree5fd05da467eac72b67a04d6180670a4c9cf1c131 /nova/crypto.py
parent3703567e1f370457fb9425de3734193dde7d41e9 (diff)
parent32b0adb591f80ad2c5c19519b4ffc2b55dbea672 (diff)
downloadnova-1a6d32b9690b4bff709dc83bcf4c2d3a65fd7c3e.tar.gz
Merge "Catch ProcessExecutionError in revoke_cert"
Diffstat (limited to 'nova/crypto.py')
-rw-r--r--nova/crypto.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/nova/crypto.py b/nova/crypto.py
index c718e053f3..8d6f8d4402 100644
--- a/nova/crypto.py
+++ b/nova/crypto.py
@@ -274,13 +274,18 @@ def ssh_encrypt_text(ssh_public_key, text):
def revoke_cert(project_id, file_name):
"""Revoke a cert by file name."""
start = os.getcwd()
- os.chdir(ca_folder(project_id))
- # NOTE(vish): potential race condition here
- utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke',
- file_name)
- utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf',
- '-out', CONF.crl_file)
- os.chdir(start)
+ if not os.chdir(ca_folder(project_id)):
+ raise exception.ProjectNotFound(project_id=project_id)
+ try:
+ # NOTE(vish): potential race condition here
+ utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke',
+ file_name)
+ utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf',
+ '-out', CONF.crl_file)
+ except processutils.ProcessExecutionError:
+ raise exception.RevokeCertFailure(project_id=project_id)
+ finally:
+ os.chdir(start)
def revoke_certs_by_user(user_id):