Resolve linting messages in readthedocs.privacy.*
parent
063ecd4bca
commit
3b80741939
|
@ -105,7 +105,8 @@ class VersionManager(RelatedProjectManager):
|
|||
return queryset.distinct()
|
||||
|
||||
def public(self, user=None, project=None, only_active=True, *args, **kwargs):
|
||||
queryset = self.filter(project__privacy_level=constants.PUBLIC, privacy_level=constants.PUBLIC)
|
||||
queryset = self.filter(project__privacy_level=constants.PUBLIC,
|
||||
privacy_level=constants.PUBLIC)
|
||||
if user:
|
||||
queryset = self._add_user_repos(queryset, user)
|
||||
if project:
|
||||
|
@ -151,4 +152,3 @@ class AdminPermission(object):
|
|||
|
||||
class AdminNotAuthorized(ValueError):
|
||||
pass
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ class RemoteSyncer(object):
|
|||
|
||||
Respects the ``MULTIPLE_APP_SERVERS`` setting when copying.
|
||||
"""
|
||||
SYNC_USER = getattr(settings, 'SYNC_USER', getpass.getuser())
|
||||
MULTIPLE_APP_SERVERS = getattr(settings, 'MULTIPLE_APP_SERVERS', [])
|
||||
if MULTIPLE_APP_SERVERS:
|
||||
sync_user = getattr(settings, 'SYNC_USER', getpass.getuser())
|
||||
app_servers = getattr(settings, 'MULTIPLE_APP_SERVERS', [])
|
||||
if app_servers:
|
||||
log.info("Remote Copy %s to %s" % (path, target))
|
||||
for server in MULTIPLE_APP_SERVERS:
|
||||
mkdir_cmd = ("ssh %s@%s mkdir -p %s" % (SYNC_USER, server, target))
|
||||
for server in app_servers:
|
||||
mkdir_cmd = ("ssh %s@%s mkdir -p %s" % (sync_user, server, target))
|
||||
ret = os.system(mkdir_cmd)
|
||||
if ret != 0:
|
||||
log.info("COPY ERROR to app servers:")
|
||||
|
@ -53,13 +53,14 @@ class RemoteSyncer(object):
|
|||
else:
|
||||
slash = "/"
|
||||
# Add a slash when copying directories
|
||||
sync_cmd = "rsync -e 'ssh -T' -av --delete {path}{slash} {user}@{server}:{target}".format(
|
||||
path=path,
|
||||
slash=slash,
|
||||
user=SYNC_USER,
|
||||
server=server,
|
||||
target=target,
|
||||
)
|
||||
sync_cmd = (
|
||||
"rsync -e 'ssh -T' -av --delete {path}{slash} {user}@{server}:{target}"
|
||||
.format(
|
||||
path=path,
|
||||
slash=slash,
|
||||
user=sync_user,
|
||||
server=server,
|
||||
target=target))
|
||||
ret = os.system(sync_cmd)
|
||||
if ret != 0:
|
||||
log.info("COPY ERROR to app servers.")
|
||||
|
@ -75,28 +76,29 @@ class DoubleRemotePuller(object):
|
|||
|
||||
Respects the ``MULTIPLE_APP_SERVERS`` setting when copying.
|
||||
"""
|
||||
SYNC_USER = getattr(settings, 'SYNC_USER', getpass.getuser())
|
||||
MULTIPLE_APP_SERVERS = getattr(settings, 'MULTIPLE_APP_SERVERS', [])
|
||||
sync_user = getattr(settings, 'SYNC_USER', getpass.getuser())
|
||||
app_servers = getattr(settings, 'MULTIPLE_APP_SERVERS', [])
|
||||
if not file:
|
||||
path += "/"
|
||||
log.info("Remote Copy %s to %s" % (path, target))
|
||||
for server in MULTIPLE_APP_SERVERS:
|
||||
for server in app_servers:
|
||||
if not file:
|
||||
mkdir_cmd = "ssh {user}@{server} mkdir -p {target}".format(
|
||||
user=SYNC_USER, server=server, target=target
|
||||
user=sync_user, server=server, target=target
|
||||
)
|
||||
ret = os.system(mkdir_cmd)
|
||||
if ret != 0:
|
||||
log.info("MKDIR ERROR to app servers:")
|
||||
log.info(mkdir_cmd)
|
||||
# Add a slash when copying directories
|
||||
sync_cmd = "ssh {user}@{server} 'rsync -av --delete {user}@{host}:{path} {target}'".format(
|
||||
host=host,
|
||||
path=path,
|
||||
user=SYNC_USER,
|
||||
server=server,
|
||||
target=target,
|
||||
)
|
||||
sync_cmd = (
|
||||
"ssh {user}@{server} 'rsync -av --delete {user}@{host}:{path} {target}'"
|
||||
.format(
|
||||
host=host,
|
||||
path=path,
|
||||
user=sync_user,
|
||||
server=server,
|
||||
target=target))
|
||||
ret = os.system(sync_cmd)
|
||||
if ret != 0:
|
||||
log.info("COPY ERROR to app servers.")
|
||||
|
@ -112,7 +114,7 @@ class RemotePuller(object):
|
|||
|
||||
Respects the ``MULTIPLE_APP_SERVERS`` setting when copying.
|
||||
"""
|
||||
SYNC_USER = getattr(settings, 'SYNC_USER', getpass.getuser())
|
||||
sync_user = getattr(settings, 'SYNC_USER', getpass.getuser())
|
||||
if not file:
|
||||
path += "/"
|
||||
log.info("Local Copy %s to %s" % (path, target))
|
||||
|
@ -121,7 +123,7 @@ class RemotePuller(object):
|
|||
sync_cmd = "rsync -e 'ssh -T' -av --delete {user}@{host}:{path} {target}".format(
|
||||
host=host,
|
||||
path=path,
|
||||
user=SYNC_USER,
|
||||
user=sync_user,
|
||||
target=target,
|
||||
)
|
||||
ret = os.system(sync_cmd)
|
||||
|
|
|
@ -2,12 +2,22 @@ from django.utils.module_loading import import_by_path
|
|||
from django.conf import settings
|
||||
|
||||
# Managers
|
||||
ProjectManager = import_by_path(getattr(settings, 'PROJECT_MANAGER', 'readthedocs.privacy.backend.ProjectManager'))
|
||||
VersionManager = import_by_path(getattr(settings, 'VERSION_MANAGER', 'readthedocs.privacy.backend.VersionManager'))
|
||||
RelatedProjectManager = import_by_path(getattr(settings, 'RELATED_PROJECT_MANAGER', 'readthedocs.privacy.backend.RelatedProjectManager'))
|
||||
ProjectManager = import_by_path(
|
||||
getattr(settings, 'PROJECT_MANAGER',
|
||||
'readthedocs.privacy.backend.ProjectManager'))
|
||||
VersionManager = import_by_path(
|
||||
getattr(settings, 'VERSION_MANAGER',
|
||||
'readthedocs.privacy.backend.VersionManager'))
|
||||
RelatedProjectManager = import_by_path(
|
||||
getattr(settings, 'RELATED_PROJECT_MANAGER',
|
||||
'readthedocs.privacy.backend.RelatedProjectManager'))
|
||||
|
||||
# Permissions
|
||||
AdminPermission = import_by_path(getattr(settings, 'ADMIN_PERMISSION', 'readthedocs.privacy.backend.AdminPermission'))
|
||||
AdminPermission = import_by_path(
|
||||
getattr(settings, 'ADMIN_PERMISSION',
|
||||
'readthedocs.privacy.backend.AdminPermission'))
|
||||
|
||||
# Syncers
|
||||
Syncer = import_by_path(getattr(settings, 'FILE_SYNCER', 'readthedocs.privacy.backends.syncers.LocalSyncer'))
|
||||
Syncer = import_by_path(
|
||||
getattr(settings, 'FILE_SYNCER',
|
||||
'readthedocs.privacy.backends.syncers.LocalSyncer'))
|
||||
|
|
Loading…
Reference in New Issue