Skip to content

Commit 48fd45b

Browse files
fix: don't trigger celery task if giturl is missing
fix: default git export directory path updated
1 parent 4f27508 commit 48fd45b

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/ol_openedx_git_auto_export/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ python_distribution(
1212
dependencies=[":git_auto_export"],
1313
provides=setup_py(
1414
name="ol-openedx-git-auto-export",
15-
version="0.3.1",
15+
version="0.3.2",
1616
license="BSD-3-Clause",
1717
description="A plugin that auto saves the course OLX to git when an author publishes it",
1818
entry_points={

src/ol_openedx_git_auto_export/settings/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
def plugin_settings(settings):
77
"""Settings for the git auto export plugin.""" # noqa: D401
8-
settings.GIT_REPO_EXPORT_DIR = "/edx/var/edxapp/export_course_repos"
8+
settings.GIT_REPO_EXPORT_DIR = "/openedx/export_course_repos"
99
settings.FEATURES[ENABLE_GIT_AUTO_EXPORT] = True

src/ol_openedx_git_auto_export/settings/production.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
def plugin_settings(settings):
77
"""Settings for the git auto export plugin.""" # noqa: D401
8-
settings.GIT_REPO_EXPORT_DIR = "/edx/var/edxapp/export_course_repos"
8+
settings.GIT_REPO_EXPORT_DIR = "/openedx/export_course_repos"
99
settings.FEATURES[ENABLE_GIT_AUTO_EXPORT] = True

src/ol_openedx_git_auto_export/signals.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.dispatch import receiver
66
from ol_openedx_git_auto_export.constants import ENABLE_GIT_AUTO_EXPORT
77
from ol_openedx_git_auto_export.tasks import async_export_to_git
8-
from xmodule.modulestore.django import SignalHandler
8+
from xmodule.modulestore.django import SignalHandler, modulestore
99

1010
log = logging.getLogger(__name__)
1111

@@ -20,7 +20,7 @@ def listen_for_course_publish(
2020
Receives publishing signal and performs publishing related workflows
2121
"""
2222
git_repo_export_dir = getattr(
23-
settings, "GIT_REPO_EXPORT_DIR", "/edx/var/edxapp/export_course_repos"
23+
settings, "GIT_REPO_EXPORT_DIR", "/openedx/export_course_repos"
2424
)
2525
if not os.path.exists(git_repo_export_dir): # noqa: PTH110
2626
# for development/docker/vagrant if GIT_REPO_EXPORT_DIR folder does not exist then create it # noqa: E501
@@ -32,6 +32,13 @@ def listen_for_course_publish(
3232
if settings.FEATURES.get("ENABLE_EXPORT_GIT") and settings.FEATURES.get(
3333
ENABLE_GIT_AUTO_EXPORT
3434
):
35+
course_module = modulestore().get_course(course_key)
36+
if not course_module.giturl:
37+
log.info(
38+
"Course %s does not have a GIT URL set in course advance settings, skipping export.", # noqa: E501
39+
course_module.id,
40+
)
41+
return
3542
# If the Git auto-export is enabled, push the course changes to Git
3643
log.info(
3744
"Course published with auto-export enabled. Starting export... (course id: %s)", # noqa: E501

src/ol_openedx_git_auto_export/tasks.py

-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ def async_export_to_git(course_key_string, user=None):
1515
course_key = CourseKey.from_string(course_key_string)
1616
course_module = modulestore().get_course(course_key)
1717

18-
if course_module.giturl is None:
19-
LOGGER.debug(
20-
"Course %s does not have a giturl, skipping export.",
21-
course_module.id,
22-
)
23-
return
24-
2518
try:
2619
LOGGER.debug(
2720
"Starting async course content export to git (course id: %s)",

0 commit comments

Comments
 (0)