ocs_ci.cleanup.aws package

Submodules

ocs_ci.cleanup.aws.cleanup module

ocs_ci.cleanup.aws.cleanup.aws_cleanup()
ocs_ci.cleanup.aws.cleanup.cleanup(cluster_name, cluster_id, upi=False, failed_deletions=None)

Cleanup existing cluster in AWS

Parameters:
  • cluster_name (str) – Name of the cluster

  • cluster_id (str) – Cluster id to cleanup

  • upi (bool) – True for UPI cluster, False otherwise

  • failed_deletions (list) – list of clusters we failed to delete, used for reporting purposes

ocs_ci.cleanup.aws.cleanup.cluster_cleanup()
ocs_ci.cleanup.aws.cleanup.delete_buckets(bucket_prefix, hours)

Delete the S3 buckets with given prefix

Parameters:
  • bucket_prefix (dict) – Bucket prefix as key and maximum hours to run/exist as value

  • hours (int) – hours older than this will be considered to delete

ocs_ci.cleanup.aws.cleanup.get_clusters(time_to_delete, region_name, prefixes_hours_to_spare, cluster_pattern=None)

Get all cluster names that their EC2 instances running time is greater than the specified time to delete

Parameters:
  • time_to_delete (int) – The maximum time in seconds that is allowed for clusters to continue running

  • region_name (str) – The name of the AWS region to delete the resources from

  • prefixes_hours_to_spare (dict) – Dictionaries of the cluster prefixes to spare along with the maximum time in hours that is allowed for spared clusters to continue running

  • cluster_pattern (str) – The name of the ec2 instances

Returns:

List of the cluster names (e.g ebenahar-cluster-gqtd4) to be provided to the

ci-cleanup script, a list of VPCs that are part of cloudformation, and a list of remaining clusters

Return type:

tuple

ocs_ci.cleanup.aws.cleanup.hour_valid(string)
Validate that the hour value provided is an int and not lower than the

minimum allowed running time

Parameters:

string – input provided to –hours

Raises:

argparse.ArgumentTypeError – if the provided hours value is not an int or lower than the minimum allowed running time

Returns:

valid hour value

Return type:

int

ocs_ci.cleanup.aws.cleanup.prefix_hour_mapping(string)

Validate that the string provided to –prefix is properly formatted

Parameters:

string (str) – input provided to –prefix

Raises:

argparse.ArgumentTypeError – if the provided string is not correctly formatted

Returns:

prefix, hours

Return type:

str, str

ocs_ci.cleanup.aws.defaults module

Defaults module for AWS cleanup

Module contents