mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
export: Fix finding manage.py to export usermessages.
We were using a hardcoded relative path, which doesn't work if you're not running this from the root of the Zulip checkout. As part of fixing this, we need to make `LOCAL_UPLOADS_DIR` an absolute path. Fixes #11581.
This commit is contained in:
@@ -13,6 +13,7 @@ import ujson
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
from scripts.lib.zulip_tools import overwrite_symlink
|
from scripts.lib.zulip_tools import overwrite_symlink
|
||||||
from zerver.lib.avatar_hash import user_avatar_path_from_ids
|
from zerver.lib.avatar_hash import user_avatar_path_from_ids
|
||||||
from analytics.models import RealmCount, UserCount, StreamCount
|
from analytics.models import RealmCount, UserCount, StreamCount
|
||||||
@@ -1422,7 +1423,8 @@ def launch_user_message_subprocesses(threads: int, output_dir: Path) -> None:
|
|||||||
logging.info('Launching %d PARALLEL subprocesses to export UserMessage rows' % (threads,))
|
logging.info('Launching %d PARALLEL subprocesses to export UserMessage rows' % (threads,))
|
||||||
|
|
||||||
def run_job(shard: str) -> int:
|
def run_job(shard: str) -> int:
|
||||||
subprocess.call(["./manage.py", 'export_usermessage_batch', '--path',
|
subprocess.call([os.path.join(settings.DEPLOY_ROOT, "manage.py"),
|
||||||
|
'export_usermessage_batch', '--path',
|
||||||
str(output_dir), '--thread', shard])
|
str(output_dir), '--thread', shard])
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,13 @@ import os
|
|||||||
import pwd
|
import pwd
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
LOCAL_UPLOADS_DIR = 'var/uploads'
|
# We want LOCAL_UPLOADS_DIR to be an absolute path so that code can
|
||||||
|
# chdir without having problems accessing it. Unfortunately, this
|
||||||
|
# means we need a duplicate definition of DEPLOY_ROOT with the one in
|
||||||
|
# settings.py.
|
||||||
|
DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')
|
||||||
|
LOCAL_UPLOADS_DIR = os.path.join(DEPLOY_ROOT, 'var/uploads')
|
||||||
|
|
||||||
FORWARD_ADDRESS_CONFIG_FILE = "var/forward_address.ini"
|
FORWARD_ADDRESS_CONFIG_FILE = "var/forward_address.ini"
|
||||||
# Check if test_settings.py set EXTERNAL_HOST.
|
# Check if test_settings.py set EXTERNAL_HOST.
|
||||||
EXTERNAL_HOST = os.getenv('EXTERNAL_HOST')
|
EXTERNAL_HOST = os.getenv('EXTERNAL_HOST')
|
||||||
|
|||||||
Reference in New Issue
Block a user