Commit fd664911 by Feanil Patel

Relocate xml tasks and switch to using bz2.

parent 8f772890
...@@ -219,37 +219,6 @@ ...@@ -219,37 +219,6 @@
- "restart edxapp" - "restart edxapp"
- "restart edxapp_workers" - "restart edxapp_workers"
# Need to do this because s3 module fails when trying
# to checksum a multipart s3 object. And overwrite is
# not effective
- name: remove existing coursedata file
file: path="/var/tmp/xml_coursedata.tar.gz" state=absent
# Install the xml courses from an s3 bucket
- name: download xml coursedata from s3
s3: >
bucket="{{ EDXAPP_XML_S3_BUCKET }}"
object="{{ EDXAPP_XML_S3_KEY }}"
mode="get"
dest="/var/tmp/xml_coursedata.tar.gz"
when: not EDXAPP_XML_FROM_GIT and EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY
register: download_xml_s3
# Install the xml courses from a url.
- name: download xml coursedata
get_url: url="{{ EDXAPP_XML_URL }}" dest="/var/tmp/xml_coursedata.tar.gz"
when: not EDXAPP_XML_FROM_GIT and EDXAPP_XML_URL
register: download_xml_url
- name: unzip the data to the data dir
shell: >
tar xvzf /var/tmp/xml_coursedata.tar.gz
chdir="{{ edxapp_course_data_dir }}"
when: download_xml_s3.changed or download_xml_url.changed
- include: xml.yml
when: EDXAPP_XML_FROM_GIT
# If using CAS and you have a function for mapping attributes, install # If using CAS and you have a function for mapping attributes, install
# the module here. The next few tasks set up the python code sandbox # the module here. The next few tasks set up the python code sandbox
- name: install CAS attribute module - name: install CAS attribute module
...@@ -280,6 +249,39 @@ ...@@ -280,6 +249,39 @@
- "restart edxapp" - "restart edxapp"
- "restart edxapp_workers" - "restart edxapp_workers"
# The next few tasks install xml courses.
# Need to do this because s3 module fails when trying
# to checksum a multipart s3 object. And overwrite is
# not effective
- name: remove existing coursedata file
file: path="/var/tmp/xml_coursedata.tar.gz" state=absent
when: not EDXAPP_XML_FROM_GIT
# Install the xml courses from an s3 bucket
- name: download xml coursedata from s3
s3: >
bucket="{{ EDXAPP_XML_S3_BUCKET }}"
object="{{ EDXAPP_XML_S3_KEY }}"
mode="get"
dest="/var/tmp/xml_coursedata.tar.gz"
when: not EDXAPP_XML_FROM_GIT and EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY
register: download_xml_s3
# Install the xml courses from a url.
- name: download xml coursedata
get_url: url="{{ EDXAPP_XML_URL }}" dest="/var/tmp/xml_coursedata.tar.bz2"
when: not EDXAPP_XML_FROM_GIT and EDXAPP_XML_URL
register: download_xml_url
- name: unzip the data to the data dir
shell: >
tar xvjf /var/tmp/xml_coursedata.tar.bz2
chdir="{{ edxapp_course_data_dir }}"
when: download_xml_s3.changed or download_xml_url.changed
- include: xml.yml
when: EDXAPP_XML_FROM_GIT
# The next few tasks set up the python code sandbox # The next few tasks set up the python code sandbox
# need to disable this profile, otherwise the pip inside the sandbox venv has no permissions # need to disable this profile, otherwise the pip inside the sandbox venv has no permissions
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
when: item.disposition == "import" when: item.disposition == "import"
- name: create an archive of course data and course static dirs - name: create an archive of course data and course static dirs
shell: tar czf /tmp/static_course_content.tar.gz -C {{ edxapp_data_dir }} {{ edxapp_course_data_dir|basename }} {{ edxapp_course_static_dir|basename }} shell: tar cjf /tmp/static_course_content.tar.bz2 -C {{ edxapp_data_dir }} {{ edxapp_course_data_dir|basename }} {{ edxapp_course_static_dir|basename }}
when: EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY when: EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY
- name: upload archive to s3 - name: upload archive to s3
...@@ -59,9 +59,9 @@ ...@@ -59,9 +59,9 @@
object="{{ EDXAPP_XML_S3_KEY }}" object="{{ EDXAPP_XML_S3_KEY }}"
mode=put mode=put
overwrite=True overwrite=True
src="/tmp/static_course_content.tar.gz" src="/tmp/static_course_content.tar.bz2"
when: EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY when: EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY
- name: remove archive from disk - name: remove archive from disk
file: path="/tmp/static_course_content.tar.gz" state=absent file: path="/tmp/static_course_content.tar.bz2" state=absent
when: EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY when: EDXAPP_XML_S3_BUCKET and EDXAPP_XML_S3_KEY
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment