We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dd4684 commit d8acae6Copy full SHA for d8acae6
shotty/shotty.py
@@ -15,6 +15,10 @@ def filter_instances(project):
15
instances = ec2.instances.all()
16
17
return instances
18
+def has_pending_snapshot(volume):
19
+ snapshots = list(volume.snapshots.all())
20
+ return snapshots and snapshots[0].state == 'pending'
21
+
22
23
@click.group()
24
def cli():
@@ -91,6 +95,9 @@ def create_snapshots(project):
91
95
i.wait_until_stopped()
92
96
93
97
for v in i.volumes.all():
98
+ if has_pending_snapshot(v):
99
+ print(" Skipping {0}, snapshot already in progress".format(v.id))
100
+ continue
94
101
print(" Creating snapshot of {0}".format(v.id))
102
v.create_snapshot(Description="Created by snapshotanalyzer 2020")
103
0 commit comments