Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
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
configuration
Commits
4a1d3271
Commit
4a1d3271
authored
Jan 21, 2015
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also wrap the volume tagging logic in case it fails so that we are properly notified.
parent
ed402238
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
playbooks/roles/supervisor/files/pre_supervisor_checks.py
+19
-10
No files found.
playbooks/roles/supervisor/files/pre_supervisor_checks.py
View file @
4a1d3271
...
...
@@ -127,7 +127,10 @@ if __name__ == '__main__':
break
except
:
print
(
"Failed to get EDP for {}"
.
format
(
instance_id
))
# With the time limit being 2 minutes we will
# try 5 times before giving up.
time
.
sleep
(
backoff
)
time_left
-=
backoff
backoff
=
backoff
*
2
if
environment
is
None
or
deployment
is
None
or
play
is
None
:
...
...
@@ -139,16 +142,21 @@ if __name__ == '__main__':
#get the hostname of the sandbox
hostname
=
socket
.
gethostname
()
#get the list of the volumes, that are attached to the instance
volumes
=
ec2
.
get_all_volumes
(
filters
=
{
'attachment.instance-id'
:
instance_id
})
for
volume
in
volumes
:
volume
.
add_tags
({
"hostname"
:
hostname
,
"environment"
:
environment
,
"deployment"
:
deployment
,
"cluster"
:
play
,
"instance-id"
:
instance_id
,
"created"
:
volume
.
create_time
})
try
:
#get the list of the volumes, that are attached to the instance
volumes
=
ec2
.
get_all_volumes
(
filters
=
{
'attachment.instance-id'
:
instance_id
})
for
volume
in
volumes
:
volume
.
add_tags
({
"hostname"
:
hostname
,
"environment"
:
environment
,
"deployment"
:
deployment
,
"cluster"
:
play
,
"instance-id"
:
instance_id
,
"created"
:
volume
.
create_time
})
except
:
msg
=
"Failed to tag volumes associated with {}"
.
format
(
instance_id
)
print
(
msg
)
notify
(
msg
)
try
:
for
service
in
services_for_instance
(
instance_id
):
...
...
@@ -193,6 +201,7 @@ if __name__ == '__main__':
if
notify
:
notify
(
msg
)
traceback
.
print_exc
()
raise
e
else
:
msg
=
"{}: {}"
.
format
(
prefix
,
" | "
.
join
(
report
))
print
(
msg
)
...
...
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