barbican  12.0.0
About: OpenStack Barbican is the OpenStack Key Manager service. It provides secure storage, provisioning and management of secret data.
The "Wallaby" series (latest release).
  Fossies Dox: barbican-12.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

barbican.model.clean Namespace Reference

Functions

def cleanup_unassociated_projects ()
 
def cleanup_parent_with_no_child (parent_model, child_model, threshold_date=None)
 
def cleanup_softdeletes (model, threshold_date=None)
 
def cleanup_all (threshold_date=None)
 
def _soft_delete_expired_secrets (threshold_date)
 
def _hard_delete_acls_for_soft_deleted_secrets ()
 
def _soft_delete_expired_secret_children (threshold_date)
 
def soft_delete_expired_secrets (threshold_date)
 
def clean_command (sql_url, min_num_days, do_clean_unassociated_projects, do_soft_delete_expired_secrets, verbose, log_file)
 

Variables

 CONF = config.CONF
 
 LOG = log.getLogger(__name__)
 

Function Documentation

◆ _hard_delete_acls_for_soft_deleted_secrets()

def barbican.model.clean._hard_delete_acls_for_soft_deleted_secrets ( )
private
Remove acl entries for secrets that have been soft deleted.

Removes entries in SecretACL and SecretACLUser which are for secrets
that have been soft deleted.

Definition at line 204 of file clean.py.

Referenced by barbican.model.clean._soft_delete_expired_secret_children().

◆ _soft_delete_expired_secret_children()

def barbican.model.clean._soft_delete_expired_secret_children (   threshold_date)
private
Soft delete the children tables of expired secrets.

Soft deletes the children tables  and hard deletes the ACL children
tables of the expired secrets.
:param threshold_date: threshold date for secret expiration
:returns: returns a pair for number of soft delete children and deleted
          ACLs

Definition at line 236 of file clean.py.

References barbican.model.clean._hard_delete_acls_for_soft_deleted_secrets().

Referenced by barbican.model.clean.soft_delete_expired_secrets().

◆ _soft_delete_expired_secrets()

def barbican.model.clean._soft_delete_expired_secrets (   threshold_date)
private
Soft delete expired secrets.

:param threshold_date: secrets that have expired past this date
                       will be soft deleted
:returns: total number of secrets that were soft deleted

Definition at line 181 of file clean.py.

Referenced by barbican.model.clean.soft_delete_expired_secrets().

◆ clean_command()

def barbican.model.clean.clean_command (   sql_url,
  min_num_days,
  do_clean_unassociated_projects,
  do_soft_delete_expired_secrets,
  verbose,
  log_file 
)
Clean command to clean up the database.

:param sql_url: sql connection string to connect to a database
:param min_num_days: clean up soft deletions older than this date
:param do_clean_unassociated_projects: If True, clean up
                                       unassociated projects
:param do_soft_delete_expired_secrets: If True, soft delete secrets
                                       that have expired
:param verbose: If True, log and print more information
:param log_file: If set, override the log_file configured

Definition at line 308 of file clean.py.

References barbican.model.clean.cleanup_all(), barbican.model.clean.cleanup_unassociated_projects(), and barbican.model.clean.soft_delete_expired_secrets().

◆ cleanup_all()

def barbican.model.clean.cleanup_all (   threshold_date = None)
Clean up the main soft deletable resources.

This function contains an order of calls to
clean up the soft-deletable resources.

:param threshold_date: soft deletions older than this date will be removed
:returns: total number of entries removed from the database

Definition at line 129 of file clean.py.

References barbican.model.clean.cleanup_parent_with_no_child(), and barbican.model.clean.cleanup_softdeletes().

Referenced by barbican.model.clean.clean_command().

◆ cleanup_parent_with_no_child()

def barbican.model.clean.cleanup_parent_with_no_child (   parent_model,
  child_model,
  threshold_date = None 
)
Clean up soft deletions in parent that do not have references in child.

Before running this function, the child table should be cleaned of
soft deletions. This function left outer joins the parent and child
tables and finds the parent entries that do not have a foreign key
reference in the child table. Then the results are filtered by soft
deletions and are cleaned up.

:param parent_model: table class for parent
:param child_model: table class for child which restricts parent deletion
:param threshold_date: soft deletions older than this date will be removed
:returns: total number of entries removed from database

Definition at line 70 of file clean.py.

Referenced by barbican.model.clean.cleanup_all().

◆ cleanup_softdeletes()

def barbican.model.clean.cleanup_softdeletes (   model,
  threshold_date = None 
)
Remove soft deletions from a table.

:param model: table class to remove soft deletions
:param threshold_date: soft deletions older than this date will be removed
:returns: total number of entries removed from the database

Definition at line 109 of file clean.py.

Referenced by barbican.model.clean.cleanup_all().

◆ cleanup_unassociated_projects()

def barbican.model.clean.cleanup_unassociated_projects ( )
Clean up unassociated projects.

This looks for projects that have no children entries on the dependent
tables and removes them.

Definition at line 32 of file clean.py.

Referenced by barbican.model.clean.clean_command().

◆ soft_delete_expired_secrets()

def barbican.model.clean.soft_delete_expired_secrets (   threshold_date)
Soft deletes secrets that are past expiration date.

The expired secrets and its children are marked for deletion.
ACLs are soft deleted and then purged from the database.

:param threshold_date: secrets that have expired past this date
                       will be soft deleted
:returns: the sum of soft deleted entries and hard deleted acl entries

Definition at line 281 of file clean.py.

References barbican.model.clean._soft_delete_expired_secret_children(), and barbican.model.clean._soft_delete_expired_secrets().

Referenced by barbican.model.clean.clean_command().

Variable Documentation

◆ CONF

barbican.model.clean.CONF = config.CONF

Definition at line 27 of file clean.py.

◆ LOG

barbican.model.clean.LOG = log.getLogger(__name__)

Definition at line 29 of file clean.py.