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
f9fba9ee
Commit
f9fba9ee
authored
May 23, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates according to nits.
parent
e1995838
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
playbooks/roles/supervisor/files/pre_supervisor_checks.py
+16
-11
No files found.
playbooks/roles/supervisor/files/pre_supervisor_checks.py
View file @
f9fba9ee
...
...
@@ -8,8 +8,11 @@ import subprocess
import
traceback
# Services that should be checked for migrations.
MIGRATION_SERVICES
=
[
'lms'
,
'cms'
,
'xqueue'
]
MIGRATION_COMMAND
=
"{python} {code_dir}/manage.py {env} migrate --noinput --settings=aws --db-dry-run --merge"
MIGRATION_COMMANDS
=
{
'lms'
:
"{python} {code_dir}/manage.py lms migrate --noinput --settings=aws --db-dry-run --merge"
,
'cms'
:
"{python} {code_dir}/manage.py cms migrate --noinput --settings=aws --db-dry-run --merge"
,
'xqueue'
:
"{python} {code_dir}/manage.py xqueue migrate --noinput --settings=aws --db-dry-run --merge"
,
}
HIPCHAT_USER
=
"PreSupervisor"
def
services_for_instance
(
instance_id
):
...
...
@@ -94,15 +97,18 @@ if __name__ == '__main__':
prefix
=
instance_id
try
:
edp
=
edp_for_instance
(
instance_id
)
prefix
=
"{}-{}-{}-{}"
.
format
(
edp
[
0
],
edp
[
1
],
edp
[
2
],
instance_id
)
environment
,
deployment
,
play
=
edp_for_instance
(
instance_id
)
prefix
=
"{environment}-{deployment}-{play}-{instance_id}"
.
format
(
environment
=
environment
,
deployment
=
deployment
,
play
=
play
,
instance_id
=
instance_id
)
for
service
in
services_for_instance
(
instance_id
):
if
service
in
MIGRATION_
SERVICE
S
:
if
service
in
MIGRATION_
COMMAND
S
:
# Do extra migration related stuff.
if
(
service
==
'lms'
or
service
==
'cms'
)
and
args
.
edxapp_code_dir
:
cmd
=
MIGRATION_COMMAND
.
format
(
python
=
args
.
edxapp_python
,
code_dir
=
args
.
edxapp_code_dir
,
env
=
service
)
cmd
=
MIGRATION_COMMANDS
[
service
]
.
format
(
python
=
args
.
edxapp_python
,
code_dir
=
args
.
edxapp_code_dir
)
if
os
.
path
.
exists
(
args
.
edxapp_code_dir
):
os
.
chdir
(
args
.
edxapp_code_dir
)
# Run migration check command.
...
...
@@ -110,9 +116,8 @@ if __name__ == '__main__':
if
'Migrating'
in
output
:
raise
Exception
(
"Migrations have not been run for {}"
.
format
(
service
))
elif
service
==
'xqueue'
and
args
.
xqueue_code_dir
:
cmd
=
MIGRATION_COMMAND
.
format
(
python
=
args
.
xqueue_python
,
code_dir
=
xqueue_code_dir
,
env
=
service
)
cmd
=
MIGRATION_COMMANDS
[
service
]
.
format
(
python
=
args
.
xqueue_python
,
code_dir
=
xqueue_code_dir
)
if
os
.
path
.
exists
(
args
.
xqueue_code_dir
):
os
.
chdir
(
args
.
xqueue_code_dir
)
# Run migration check command.
...
...
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