Loading README.rst +1 −1 Original line number Diff line number Diff line Loading @@ -10,4 +10,4 @@ TODO - Changelog. - README, - Testing with different Python versions with tox and flake8. - Specify number of versions to keep. - Specify number of versions to keep, dry-run option. eb_prune/__init__.py +13 −9 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ from botocore import session def main(): versions_to_keep = 400 dry_run = False print('Pruning Elastic Beanstalk versions.') aws_session = session.get_session() beanstalk_client = aws_session.create_client('elasticbeanstalk') Loading @@ -21,8 +23,10 @@ def main(): lambda x: (not x['VersionLabel'] in active_versions) and x['Status'] == 'UNPROCESSED', versions) old_versions = sorted(previous_versions, key=lambda x: x.get('DateCreated'))[:-400] key=lambda x: x.get('DateCreated'))[:-versions_to_keep] for version in old_versions: if not dry_run: response = beanstalk_client.delete_application_version( ApplicationName=version['ApplicationName'], VersionLabel=version['VersionLabel'], Loading Loading
README.rst +1 −1 Original line number Diff line number Diff line Loading @@ -10,4 +10,4 @@ TODO - Changelog. - README, - Testing with different Python versions with tox and flake8. - Specify number of versions to keep. - Specify number of versions to keep, dry-run option.
eb_prune/__init__.py +13 −9 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ from botocore import session def main(): versions_to_keep = 400 dry_run = False print('Pruning Elastic Beanstalk versions.') aws_session = session.get_session() beanstalk_client = aws_session.create_client('elasticbeanstalk') Loading @@ -21,8 +23,10 @@ def main(): lambda x: (not x['VersionLabel'] in active_versions) and x['Status'] == 'UNPROCESSED', versions) old_versions = sorted(previous_versions, key=lambda x: x.get('DateCreated'))[:-400] key=lambda x: x.get('DateCreated'))[:-versions_to_keep] for version in old_versions: if not dry_run: response = beanstalk_client.delete_application_version( ApplicationName=version['ApplicationName'], VersionLabel=version['VersionLabel'], Loading