@@ -554,9 +554,9 @@ def finish_build(version_pk, build_pk, hostname=None, html=False,
554
554
version .save ()
555
555
556
556
if not pdf :
557
- clear_pdf_artifacts ( version )
557
+ broadcast ( type = 'app' , task = clear_pdf_artifacts , args = [ version . pk ] )
558
558
if not epub :
559
- clear_epub_artifacts ( version )
559
+ broadcast ( type = 'app' , task = clear_epub_artifacts , args = [ version . pk ] )
560
560
561
561
# Sync files to the web servers
562
562
broadcast (type = 'app' , task = move_files , args = [version_pk , hostname ],
@@ -909,7 +909,6 @@ def remove_dir(path):
909
909
shutil .rmtree (path , ignore_errors = True )
910
910
911
911
912
- @task (queue = 'web' )
913
912
def clear_artifacts (version_pk ):
914
913
"""Remove artifacts from the web servers"""
915
914
version = Version .objects .get (pk = version_pk )
@@ -920,33 +919,19 @@ def clear_artifacts(version_pk):
920
919
921
920
922
921
def clear_pdf_artifacts (version ):
923
- run_on_app_servers ('rm -rf %s'
924
- % version .project .get_production_media_path (
925
- type_ = 'pdf' , version_slug = version .slug ))
922
+ remove_dir (version .project .get_production_media_path (
923
+ type_ = 'pdf' , version_slug = version .slug ))
926
924
927
925
928
926
def clear_epub_artifacts (version ):
929
- run_on_app_servers ('rm -rf %s'
930
- % version .project .get_production_media_path (
931
- type_ = 'epub' , version_slug = version .slug ))
927
+ remove_dir (version .project .get_production_media_path (
928
+ type_ = 'epub' , version_slug = version .slug ))
932
929
933
930
934
931
def clear_htmlzip_artifacts (version ):
935
- run_on_app_servers ('rm -rf %s'
936
- % version .project .get_production_media_path (
937
- type_ = 'htmlzip' , version_slug = version .slug ))
932
+ remove_dir (version .project .get_production_media_path (
933
+ type_ = 'htmlzip' , version_slug = version .slug ))
938
934
939
935
940
936
def clear_html_artifacts (version ):
941
- run_on_app_servers ('rm -rf %s' % version .project .rtd_build_path (version = version .slug ))
942
-
943
-
944
- @task (queue = 'web' )
945
- def remove_path_from_web (path ):
946
- """Remove the given path from the web servers file system."""
947
- # Santity check for spaces in the path since spaces would result in
948
- # deleting unpredictable paths with "rm -rf".
949
- assert ' ' not in path , "No spaces allowed in path"
950
-
951
- # TODO: We need some proper escaping here for the given path.
952
- run_on_app_servers ('rm -rf {path}' .format (path = path ))
937
+ remove_dir (version .project .rtd_build_path (version = version .slug ))
0 commit comments