Синхронизация удалённого профиля при помощи zstd

legacy27 3.6.9.5
parent a2674d482e
commit 915951abec

@ -1317,16 +1317,28 @@ class Client(commandServer, encrypt, Desktop):
def syncLoginProfileNew(self, host, username, pwd,
uid, gid, homeDir,
profileName, clearHomeDir=True):
profileName, replHost=False,
clearHomeDir=True):
"""
Получить профиль пользователя из домена
"""
ps = self.get_syncer(host, username, pwd)
# if currect server has any files then sync it
remoteProfile = "::profile/{}".format(profileName)
if replHost:
remoteOpts = ("-c", "--zc=zstd")
else:
remoteOpts = ()
if not self.syncUserNew(ps, uid, gid, homeDir, "login",
remoteProfile, host=host):
remoteProfile, host=host,
rsyncopts=remoteOpts):
error_output = ps.output
if remoteOpts and re.search(r"(on remote machine.*unknown option|"
"unknown compress name:)",
error_output):
if self.syncUserNew(ps, uid, gid, homeDir, "login",
remoteProfile, host=host):
return True
if re.search(r'change_dir "\?{resPath}" \(in {resName}\) '
'failed: No such file or directory'.format(
resPath=profileName,
@ -1365,11 +1377,12 @@ class Client(commandServer, encrypt, Desktop):
def syncUserNew(self, ps, uid, gid, userHome, sync,
remoteProfile,
host="default", skipList=()):
host="default", skipList=(), rsyncopts=()):
"""
Синхронизация профиля пользователя
"""
execStr = ""
rsyncopts = list(rsyncopts)
skipPaths = self.clVars.Get("cl_sync_skip_path")
if not skipPaths:
self.printERROR(
@ -1410,6 +1423,7 @@ class Client(commandServer, encrypt, Desktop):
title = _("Uploading the user profile to %s") % host
self.startTask(title)
self.addProgress()
rsyncParams.extend(rsyncopts)
for i in ps.sync("%s/"%source, "%s/"%target, *rsyncParams):
self.setProgress(i)

@ -196,7 +196,7 @@ class ClClientSyncLoginAction(Action):
},
{'name': 'sync_local2:sync_remote2',
'method': 'Client.syncLoginProfileNew(cl_replication_host,ur_login,desktop.ur_password,ur_uid,'
'ur_gid,ur_home_path,cl_client_profile_name)',
'ur_gid,ur_home_path,cl_client_profile_name,True)',
'condition': lambda Get: Get('cl_replication_host')
},
# если синхронизация с удаленным доменом прошла с ошибкой

Loading…
Cancel
Save