Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eb-prune
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
eb-prune
Commits
e79150fc
Commit
e79150fc
authored
9 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Added TODO item of dry_run mode.
- Starting work on command arguments.
parent
1483774b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+1
-1
1 addition, 1 deletion
README.rst
eb_prune/__init__.py
+13
-9
13 additions, 9 deletions
eb_prune/__init__.py
with
14 additions
and
10 deletions
README.rst
+
1
−
1
View file @
e79150fc
...
...
@@ -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
.
This diff is collapsed.
Click to expand it.
eb_prune/__init__.py
+
13
−
9
View file @
e79150fc
...
...
@@ -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
'
)
...
...
@@ -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
'
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment