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
3eadd669
Commit
3eadd669
authored
Apr 28, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for on disk courses.
parent
0a103f88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
util/import_xml_courses.py
+22
-12
No files found.
util/import_xml_courses.py
View file @
3eadd669
...
@@ -34,13 +34,13 @@ if __name__ == '__main__':
...
@@ -34,13 +34,13 @@ if __name__ == '__main__':
repo_url
=
cols
[
4
]
repo_url
=
cols
[
4
]
if
author_format
.
lower
()
!=
'xml'
\
if
author_format
.
lower
()
!=
'xml'
\
or
disposition
.
lower
()
==
"don't import"
\
or
disposition
.
lower
()
==
"don't import"
:
or
disposition
.
lower
()
==
'on disk'
:
continue
continue
# Checkout w/tilde
logging
.
debug
(
"{}: {}"
.
format
(
slug
,
repo_url
))
logging
.
debug
(
"{}: {}"
.
format
(
slug
,
repo_url
))
org
,
course
,
run
=
slug
.
split
(
"/"
)
org
,
course
,
run
=
slug
.
split
(
"/"
)
repo_name
=
"{}"
.
format
(
basename
(
repo_url
)
.
rstrip
(
'.git'
),
run
)
repo_name
=
"{}
~{}
"
.
format
(
basename
(
repo_url
)
.
rstrip
(
'.git'
),
run
)
# Clone course into data dir.
# Clone course into data dir.
repo_location
=
join
(
args
.
data_dir
,
repo_name
)
repo_location
=
join
(
args
.
data_dir
,
repo_name
)
...
@@ -57,16 +57,26 @@ if __name__ == '__main__':
...
@@ -57,16 +57,26 @@ if __name__ == '__main__':
f
.
write
(
xml_content
.
format
(
org
,
course
,
run
))
f
.
write
(
xml_content
.
format
(
org
,
course
,
run
))
f
.
close
()
f
.
close
()
# Import the course
if
disposition
.
lower
()
==
"import"
:
if
disposition
.
lower
()
==
"on disk"
:
# Import into cms
pass
cmd
=
"sudo -E -u edxapp /edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py cms --settings=aws import {} {}"
.
format
(
args
.
data_dir
,
repo_name
)
elif
disposition
.
lower
()
==
'no static import'
:
logging
.
debug
(
"Running cmd:: {}"
.
format
(
cmd
))
# Import w/nostatic flag
subprocess
.
check_call
(
cmd
,
shell
=
True
)
elif
disposition
.
lower
()
==
"no static import"
:
# Update courses.xml
# Import with --nostatic
cmd
=
"sudo -E -u edxapp /edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py cms --settings=aws import --nostatic {} {}"
.
format
(
args
.
data_dir
,
repo_name
)
cmd
=
"sudo -E -u edxapp /edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py cms --settings=aws import --nostatic {} {}"
.
format
(
args
.
data_dir
,
repo_name
)
logging
.
debug
(
"Running cmd:: {}"
.
format
(
cmd
))
logging
.
debug
(
"Running cmd:: {}"
.
format
(
cmd
))
subprocess
.
check_call
(
cmd
,
shell
=
True
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
elif
disposition
.
lower
()
==
'import'
:
# Import
cmd
=
"sudo -E -u edxapp /edx/bin/python.edxapp /edx/app/edxapp/edx-platform/manage.py cms --settings=aws import {} {}"
.
format
(
args
.
data_dir
,
repo_name
)
logging
.
debug
(
"Running cmd: {}"
.
format
(
cmd
))
subprocess
.
check_call
(
cmd
,
shell
=
True
)
# Remove from disk.
cmd
=
"sudo rm -rf {}"
.
format
(
repo_location
)
logging
.
debug
(
"Running cmd: {}"
.
format
(
cmd
))
subprocess
.
check_call
(
cmd
,
shell
=
True
)
# Create the tar file of all xml courses
cmd
=
"sudo tar cvzf static_course_content.tar.gz {}"
.
format
(
args
.
data_dir
)
logging
.
debug
(
"Running cmd: {}"
.
format
(
cmd
))
subprocess
.
check_call
(
cmd
,
shell
=
True
)
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