From 915951abec9669dbc0bf6fbab6a1a0811adedbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Fri, 2 Apr 2021 16:46:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D1=91=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D1=80=D0=BE=D1=84?= =?UTF-8?q?=D0=B8=D0=BB=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=BE=D0=BC?= =?UTF-8?q?=D0=BE=D1=89=D0=B8=20zstd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/client/client.py | 20 +++++++++++++++++--- pym/client/utils/cl_client_sync.py | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pym/client/client.py b/pym/client/client.py index 1934d79..9578aed 100644 --- a/pym/client/client.py +++ b/pym/client/client.py @@ -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) diff --git a/pym/client/utils/cl_client_sync.py b/pym/client/utils/cl_client_sync.py index bbdd3b0..b4c146b 100644 --- a/pym/client/utils/cl_client_sync.py +++ b/pym/client/utils/cl_client_sync.py @@ -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') }, # если синхронизация с удаленным доменом прошла с ошибкой