feat: copy the 1wg files to so... many... places... (#8347)

This commit is contained in:
Robert Sparks 2024-12-19 12:06:38 -06:00 committed by GitHub
parent 1fb70d817f
commit fdd378390f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 15 deletions

View file

@ -43,23 +43,28 @@ def generate_wg_charters_files_task():
encoding="utf8",
)
charter_copy_dest = getattr(settings, "CHARTER_COPY_PATH", None)
if charter_copy_dest is not None:
if not Path(charter_copy_dest).is_dir():
log.log(
f"Error copying 1wg-charter files to {charter_copy_dest}: it does not exist or is not a directory"
)
else:
try:
shutil.copy2(charters_file, charter_copy_dest)
except IOError as err:
log.log(f"Error copying {charters_file} to {charter_copy_dest}: {err}")
try:
shutil.copy2(charters_by_acronym_file, charter_copy_dest)
except IOError as err:
charter_copy_dests = [
getattr(settings, "CHARTER_COPY_PATH", None),
getattr(settings, "CHARTER_COPY_OTHER_PATH", None),
getattr(settings, "CHARTER_COPY_THIRD_PATH", None),
]
for charter_copy_dest in charter_copy_dests:
if charter_copy_dest is not None:
if not Path(charter_copy_dest).is_dir():
log.log(
f"Error copying {charters_by_acronym_file} to {charter_copy_dest}: {err}"
f"Error copying 1wg-charter files to {charter_copy_dest}: it does not exist or is not a directory"
)
else:
try:
shutil.copy2(charters_file, charter_copy_dest)
except IOError as err:
log.log(f"Error copying {charters_file} to {charter_copy_dest}: {err}")
try:
shutil.copy2(charters_by_acronym_file, charter_copy_dest)
except IOError as err:
log.log(
f"Error copying {charters_by_acronym_file} to {charter_copy_dest}: {err}"
)
@shared_task

View file

@ -62,6 +62,8 @@ class GroupPagesTests(TestCase):
settings_temp_path_overrides = TestCase.settings_temp_path_overrides + [
"CHARTER_PATH",
"CHARTER_COPY_PATH",
"CHARTER_COPY_OTHER_PATH", # Note: not explicitly testing use of
"CHARTER_COPY_THIRD_PATH", # either of these settings
"GROUP_SUMMARY_PATH",
]

View file

@ -744,6 +744,8 @@ INTERNET_DRAFT_PDF_PATH = '/a/www/ietf-datatracker/pdf/'
RFC_PATH = '/a/www/ietf-ftp/rfc/'
CHARTER_PATH = '/a/ietfdata/doc/charter/'
CHARTER_COPY_PATH = '/a/www/ietf-ftp/ietf' # copy 1wg-charters files here if set
CHARTER_COPY_OTHER_PATH = '/a/www/ftp/ietf'
CHARTER_COPY_THIRD_PATH = '/a/www/ftp/charter'
GROUP_SUMMARY_PATH = '/a/www/ietf-ftp/ietf'
BOFREQ_PATH = '/a/ietfdata/doc/bofreq/'
CONFLICT_REVIEW_PATH = '/a/ietfdata/doc/conflict-review'