Skip to content

Instantly share code, notes, and snippets.

@rm-you
Created April 2, 2015 22:21
Show Gist options
  • Save rm-you/5f75ad88b634335b1801 to your computer and use it in GitHub Desktop.
Save rm-you/5f75ad88b634335b1801 to your computer and use it in GitHub Desktop.
@staticmethod
def _actually_delete_cert(cert_ref):
"""Deletes the specified cert. Very dangerous. Do not recommend.
:param cert_ref: the UUID of the cert to delete
:raises Exception: if certificate deletion fails
"""
connection = BarbicanKeystoneAuth.get_barbican_client()
LOG.info(_LI(
"Recursively deleting certificate container {0} from Barbican."
).format(cert_ref))
try:
certificate_container = connection.containers.get(cert_ref)
for ref in certificate_container.secret_refs:
connection.secrets.delete(secret_ref=ref)
certificate_container.delete()
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_LE(
"Error recursively deleting certificate container {0}"
).format(cert_ref))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment