Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
436b5925
Commit
436b5925
authored
Mar 10, 2014
by
Hagai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added wait_timeout option
parent
c900254e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
library/cloud/ec2_snapshot
+6
-0
No files found.
library/cloud/ec2_snapshot
View file @
436b5925
...
...
@@ -125,6 +125,7 @@ def main():
ec2_secret_key
=
dict
(
aliases
=
[
'aws_secret_key'
,
'secret_key'
],
no_log
=
True
),
ec2_access_key
=
dict
(
aliases
=
[
'aws_access_key'
,
'access_key'
]),
wait
=
dict
(
choices
=
BOOLEANS
,
default
=
'true'
),
wait_timeout
=
dict
(
type
=
'number'
,
default
=
0
),
snapshot_tags
=
dict
(
type
=
'dict'
,
default
=
dict
()),
)
)
...
...
@@ -134,6 +135,7 @@ def main():
instance_id
=
module
.
params
.
get
(
'instance_id'
)
device_name
=
module
.
params
.
get
(
'device_name'
)
wait
=
module
.
params
.
get
(
'wait'
)
wait_timeout
=
module
.
params
.
get
(
'wait_timeout'
)
snapshot_tags
=
module
.
params
.
get
(
'snapshot_tags'
)
if
not
volume_id
and
not
instance_id
or
volume_id
and
instance_id
:
...
...
@@ -154,11 +156,15 @@ def main():
try
:
snapshot
=
ec2
.
create_snapshot
(
volume_id
,
description
=
description
)
time_waited
=
0
if
wait
:
snapshot
.
update
()
while
snapshot
.
status
!=
'completed'
:
time
.
sleep
(
3
)
snapshot
.
update
()
time_waited
+=
3
if
wait_timeout
and
time_waited
>
wait_timeout
:
module
.
fail_json
(
'Timed out while creating snapshot.'
)
for
k
,
v
in
snapshot_tags
.
items
():
snapshot
.
add_tag
(
k
,
v
)
except
boto
.
exception
.
BotoServerError
,
e
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment