()
If the container was recreated and it's not a minor/major upgrade,
    we need to fix the media/avatars and media/custom symlink.
If the container was recreated and it's not a minor/major upgrade,
    we need to fix the media/avatars and media/custom symlink.
If the container was recreated and it s not a minor / major upgrade we need to fix the media / avatars and media / custom symlink .
def fix_media_symlinks():
    """
    If the container was recreated and it's not a minor/major upgrade,
    we need to fix the media/avatars and media/custom symlink.
    """
    media_dir = join(installdir, 'seahub/media')
    avatars_dir = join(media_dir, 'avatars')
    custom_dir = join(media_dir, 'custom')
    dst_media_dir = ('/shared/seafile/seahub-data')
    dst_avatars_dir = join(dst_media_dir, 'avatars')
    dst_custom_dir = join(dst_media_dir, 'custom')
    if not islink(avatars_dir):
        logger.info('The container was recreated, start fix the media symlinks')
        call('mv -n %s/* %s' % (avatars_dir, dst_avatars_dir))
        call('rm -rf %s' % avatars_dir)
        call('ln -sf %s %s' % (dst_avatars_dir, avatars_dir))
        call('rm -rf %s' % custom_dir)
        call('ln -sf %s %s' % (dst_custom_dir, custom_dir))
        logger.info('Done')
def fix_media_symlinks ( ) : media_dir = join ( installdir , 'seahub/media' ) avatars_dir = join ( media_dir , 'avatars' ) custom_dir = join ( media_dir , 'custom' ) dst_media_dir = ( '/shared/seafile/seahub-data' ) dst_avatars_dir = join ( dst_media_dir , 'avatars' ) dst_custom_dir = join ( dst_media_dir , 'custom' ) if not islink ( avatars_dir ) : logger . info ( 'The container was recreated, start fix the media symlinks' ) call ( 'mv -n %s/* %s' % ( avatars_dir , dst_avatars_dir ) ) call ( 'rm -rf %s' % avatars_dir ) call ( 'ln -sf %s %s' % ( dst_avatars_dir , avatars_dir ) ) call ( 'rm -rf %s' % custom_dir ) call ( 'ln -sf %s %s' % ( dst_custom_dir , custom_dir ) ) logger . info ( 'Done' )