copy beta files to the mirror staging area (bug 629414)
This commit is contained in:
Родитель
9d1cceb09d
Коммит
378596493b
|
@ -118,6 +118,9 @@ STATUS_UNDER_REVIEW = (STATUS_UNREVIEWED, STATUS_NOMINATED,
|
|||
|
||||
LITE_STATUSES = (STATUS_LITE, STATUS_LITE_AND_NOMINATED)
|
||||
|
||||
MIRROR_STATUSES = (STATUS_PUBLIC, STATUS_BETA,
|
||||
STATUS_LITE, STATUS_LITE_AND_NOMINATED)
|
||||
|
||||
# Types of administrative review queues for an add-on:
|
||||
ADMIN_REVIEW_FULL = 1
|
||||
ADMIN_REVIEW_PRELIM = 2
|
||||
|
|
|
@ -109,10 +109,13 @@ class File(amo.models.ModelBase):
|
|||
f.save()
|
||||
log.debug('New file: %r from %r' % (f, upload))
|
||||
# Move the uploaded file from the temp location.
|
||||
dest = path.path(version.path_prefix)
|
||||
if not dest.exists():
|
||||
dest.makedirs()
|
||||
upload.path.copyfile(dest / nfd_str(f.filename))
|
||||
destinations = [path.path(version.path_prefix)]
|
||||
if f.status in amo.MIRROR_STATUSES:
|
||||
destinations.append(path.path(version.mirror_path_prefix))
|
||||
for dest in destinations:
|
||||
if not dest.exists():
|
||||
dest.makedirs()
|
||||
upload.path.copyfile(dest / nfd_str(f.filename))
|
||||
FileValidation.from_json(f, upload.validation)
|
||||
return f
|
||||
|
||||
|
@ -226,6 +229,7 @@ class Approval(amo.models.ModelBase):
|
|||
.annotate(models.Count('approval'))
|
||||
.order_by('-approval__count')[:5])
|
||||
|
||||
|
||||
class Platform(amo.models.ModelBase):
|
||||
# `name` and `shortname` are provided in amo.__init__
|
||||
# name = TranslatedField()
|
||||
|
|
|
@ -31,7 +31,9 @@ class UploadTest(test_utils.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
self._addons_path = settings.ADDONS_PATH
|
||||
self._mirror_path = settings.MIRROR_STAGE_PATH
|
||||
settings.ADDONS_PATH = tempfile.mkdtemp()
|
||||
settings.MIRROR_STAGE_PATH = tempfile.mkdtemp()
|
||||
self._rename = path.path.rename
|
||||
path.path.rename = path.path.copy
|
||||
# The validator task (post Addon upload) loads apps.json
|
||||
|
@ -41,7 +43,9 @@ class UploadTest(test_utils.TestCase):
|
|||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(settings.ADDONS_PATH)
|
||||
shutil.rmtree(settings.MIRROR_STAGE_PATH)
|
||||
settings.ADDONS_PATH = self._addons_path
|
||||
settings.MIRROR_STAGE_PATH = self._mirror_path
|
||||
path.path.rename = self._rename
|
||||
|
||||
def file_path(self, name):
|
||||
|
|
|
@ -71,6 +71,10 @@ class Version(amo.models.ModelBase):
|
|||
def path_prefix(self):
|
||||
return os.path.join(settings.ADDONS_PATH, str(self.addon_id))
|
||||
|
||||
@property
|
||||
def mirror_path_prefix(self):
|
||||
return os.path.join(settings.MIRROR_STAGE_PATH, str(self.addon_id))
|
||||
|
||||
def license_url(self):
|
||||
return reverse('addons.license', args=[self.addon.slug, self.version])
|
||||
|
||||
|
|
|
@ -141,6 +141,10 @@ ADDONS_PATH = NETAPP_STORAGE + '/addons'
|
|||
# Example: /data/uploads
|
||||
UPLOADS_PATH = NETAPP_STORAGE + '/uploads'
|
||||
|
||||
# File path for add-on files that get rsynced to mirrors.
|
||||
# /mnt/netapp_amo/addons.mozilla.org-remora/public-staging
|
||||
MIRROR_STAGE_PATH = NETAPP_STORAGE + '/public-staging'
|
||||
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://foo.com/media/", "/media/".
|
||||
|
|
Загрузка…
Ссылка в новой задаче