Maxime Guyot
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
22 additions and
1 deletions
-
scripts/openstack-cleanup/README.md
-
scripts/openstack-cleanup/main.py
|
@ -0,0 +1,21 @@ |
|
|
|
|
|
# openstack-cleanup |
|
|
|
|
|
|
|
|
|
|
|
Tool to deletes openstack servers older than a specific age (default 4h). |
|
|
|
|
|
|
|
|
|
|
|
Useful to cleanup orphan servers that are left behind when CI is manually cancelled or fails unexpectedly. |
|
|
|
|
|
|
|
|
|
|
|
## Installation |
|
|
|
|
|
|
|
|
|
|
|
```shell |
|
|
|
|
|
pip install -r requirements.txt |
|
|
|
|
|
python main.py --help |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Usage |
|
|
|
|
|
|
|
|
|
|
|
```console |
|
|
|
|
|
$ python main.py |
|
|
|
|
|
This will delete VMs... (ctrl+c to cancel) |
|
|
|
|
|
Will delete server example1 |
|
|
|
|
|
Will delete server example2 |
|
|
|
|
|
``` |
|
@ -16,7 +16,7 @@ parser = argparse.ArgumentParser(description='Cleanup OpenStack VMs') |
|
|
parser.add_argument('-v', '--verbose', action='store_true', |
|
|
parser.add_argument('-v', '--verbose', action='store_true', |
|
|
help='Increase verbosity') |
|
|
help='Increase verbosity') |
|
|
parser.add_argument('--hours', type=int, default=4, |
|
|
parser.add_argument('--hours', type=int, default=4, |
|
|
help='Age (in hours) of VMs to cleanup') |
|
|
|
|
|
|
|
|
help='Age (in hours) of VMs to cleanup (default: 4h)') |
|
|
parser.add_argument('--dry-run', action='store_true', |
|
|
parser.add_argument('--dry-run', action='store_true', |
|
|
help='Do not delete anything') |
|
|
help='Do not delete anything') |
|
|
|
|
|
|
|
|