|
|
|
@ -366,9 +366,9 @@ class Client(commandServer, encrypt):
|
|
|
|
|
def applyTemplatesFromSystem(self):
|
|
|
|
|
"""Apply templates for system"""
|
|
|
|
|
if self.clVars.Get('cl_action') == 'domain':
|
|
|
|
|
self.startTask(_("Appling domain templates"),progress=True)
|
|
|
|
|
self.startTask(_("Applying domain templates"),progress=True)
|
|
|
|
|
else:
|
|
|
|
|
self.startTask(_("Appling undomain templates"),progress=True)
|
|
|
|
|
self.startTask(_("Applying non-domain templates"),progress=True)
|
|
|
|
|
if self.clTempl:
|
|
|
|
|
self.closeClTemplate()
|
|
|
|
|
self.clTempl = ProgressTemplate(self.setProgress,self.clVars,
|
|
|
|
@ -527,7 +527,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
skipPaths = self.clVars.Get("cl_sync_skip_path")
|
|
|
|
|
if not skipPaths:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("The variable 'cl_sync_skip_path' is empty")%userHome)
|
|
|
|
|
_("Variable 'cl_sync_skip_path' empty")%userHome)
|
|
|
|
|
return False
|
|
|
|
|
deletePaths = self.clVars.Get("cl_sync_del_path")
|
|
|
|
|
if not deletePaths:
|
|
|
|
@ -551,13 +551,13 @@ class Client(commandServer, encrypt):
|
|
|
|
|
-rlptgo -x -v -v -v %s/ %s/'%(excludePaths, userHome, homeTemplate)
|
|
|
|
|
else:
|
|
|
|
|
raise ClientError(
|
|
|
|
|
_("Method syncUser: option sync=%s incorrect")%str(sync))
|
|
|
|
|
_("Method syncUser: option sync=%s is incorrect")%str(sync))
|
|
|
|
|
if execStr:
|
|
|
|
|
host = "<i>" + host +"</i>"
|
|
|
|
|
if sync == "login":
|
|
|
|
|
rsync = RsyncProgressBar(\
|
|
|
|
|
_("Receiving the file list from %s") % host,
|
|
|
|
|
_("Downloading the user profile from %s") % host,
|
|
|
|
|
_("Fetching the user profile from %s") % host,
|
|
|
|
|
execStr,self)
|
|
|
|
|
else:
|
|
|
|
|
rsync = RsyncProgressBar(\
|
|
|
|
@ -882,7 +882,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
if self.mountSleepRes(self.domain, userPwd,
|
|
|
|
|
res, rpath) is False:
|
|
|
|
|
if name == "profile":
|
|
|
|
|
self.printWARNING(_("Failed to mount user profile"))
|
|
|
|
|
self.printWARNING(_("Failed to mount the user profile"))
|
|
|
|
|
res = False
|
|
|
|
|
continue
|
|
|
|
|
else:
|
|
|
|
@ -910,10 +910,11 @@ class Client(commandServer, encrypt):
|
|
|
|
|
curStatusSync,osLinuxShort)
|
|
|
|
|
if not needSync:
|
|
|
|
|
if fromRemote:
|
|
|
|
|
self.printSUCCESS(_("Local user profile does not need "
|
|
|
|
|
"to update with local domain"))
|
|
|
|
|
self.printSUCCESS(_("The local user profile does not "
|
|
|
|
|
"need to be synchronized with local domain"))
|
|
|
|
|
else:
|
|
|
|
|
self.printSUCCESS(_("Local user profile will be used"))
|
|
|
|
|
self.printSUCCESS(_("The local user profile will be "
|
|
|
|
|
"used"))
|
|
|
|
|
# Copy private files from the server
|
|
|
|
|
self.copyPrivateFiles(lDomainProfile, self.homeDir)
|
|
|
|
|
return True
|
|
|
|
@ -973,7 +974,8 @@ class Client(commandServer, encrypt):
|
|
|
|
|
if not self.foundArchFile(strCurrentTime, archPathProcess,
|
|
|
|
|
archPathSuccess,
|
|
|
|
|
remoteServer):
|
|
|
|
|
self.printWARNING(_("Failed to find profile archive from %s")%
|
|
|
|
|
self.printWARNING(_("Failed to find the profile "
|
|
|
|
|
"archive from %s")%
|
|
|
|
|
remoteServer)
|
|
|
|
|
return False
|
|
|
|
|
if os.path.exists(archPathSuccess):
|
|
|
|
@ -991,16 +993,16 @@ class Client(commandServer, encrypt):
|
|
|
|
|
return False
|
|
|
|
|
self.endTask()
|
|
|
|
|
# unpack archive into home directory
|
|
|
|
|
self.startTask(_("Unpack profile archive"),progress=True)
|
|
|
|
|
self.startTask(_("Unpacking the profile"),progress=True)
|
|
|
|
|
if not self.unpackArch(self.homeDir, archPathDst,
|
|
|
|
|
remoteServer):
|
|
|
|
|
self.printERROR(_("Failed to unpack archive"))
|
|
|
|
|
self.printERROR(_("Failed to unpack"))
|
|
|
|
|
return False
|
|
|
|
|
# get removed files list
|
|
|
|
|
pathListFile = os.path.join(rHomeProfile,
|
|
|
|
|
self.listTemplFile)
|
|
|
|
|
if not self.removeFilesInProfile(self.homeDir,pathListFile):
|
|
|
|
|
self.printWARNING(_("Unable to remove needless files"))
|
|
|
|
|
self.printWARNING(_("Unable to remove useless files"))
|
|
|
|
|
return False
|
|
|
|
|
self.endTask()
|
|
|
|
|
return True
|
|
|
|
@ -1040,7 +1042,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
curStatusSync,osLinuxShort)
|
|
|
|
|
if not needSync:
|
|
|
|
|
# Copy private files from the server
|
|
|
|
|
self.printSUCCESS(_("Local user profile will be used"))
|
|
|
|
|
self.printSUCCESS(_("The local user profile will be used"))
|
|
|
|
|
if not self.mountLocalDomainRes(userPwd,dictRes):
|
|
|
|
|
return False
|
|
|
|
|
self.copyPrivateFiles(pathRProfile, self.homeDir)
|
|
|
|
@ -1079,10 +1081,10 @@ class Client(commandServer, encrypt):
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
self.printWARNING(
|
|
|
|
|
_("Difference time between server and "
|
|
|
|
|
"client more 10 minute"))
|
|
|
|
|
_("Time differs between server and client "
|
|
|
|
|
"for more than 10 minutes"))
|
|
|
|
|
self.printWARNING(_("Profile synchronization "
|
|
|
|
|
"will be used without archiving"))
|
|
|
|
|
"will be applied without archiving"))
|
|
|
|
|
# sync local before remote sync
|
|
|
|
|
self.syncLocalDomainRes(userPwd,dictRes,curTimeObj,
|
|
|
|
|
curStatusSync,osLinuxShort,
|
|
|
|
@ -1095,7 +1097,8 @@ class Client(commandServer, encrypt):
|
|
|
|
|
if self.sync and "remote_profile" in dictRes:
|
|
|
|
|
if isMount(rpath):
|
|
|
|
|
if not self.umountSleepPath(rpath):
|
|
|
|
|
raise ClientError(_("Failed to unmount remote profile"))
|
|
|
|
|
raise ClientError(_("Failed to unmount the "
|
|
|
|
|
"remote profile"))
|
|
|
|
|
# remote directory for remote
|
|
|
|
|
if os.path.exists(rpath) and not os.listdir(rpath):
|
|
|
|
|
os.rmdir(rpath)
|
|
|
|
@ -1112,7 +1115,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
gid = self.clVars.Get('ur_gid')
|
|
|
|
|
self.setVarToConfig("main", {"status_sync":"error"},
|
|
|
|
|
configFileName)
|
|
|
|
|
self.printERROR(_("Failed to get user profile from domain"))
|
|
|
|
|
self.printERROR(_("Failed to get the user profile from the domain"))
|
|
|
|
|
return umountResult
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1124,7 +1127,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
self.uid = int(self.clVars.Get('ur_uid'))
|
|
|
|
|
self.gid = int(self.clVars.Get('ur_gid'))
|
|
|
|
|
except ValueError as e:
|
|
|
|
|
raise ClientError(_("Failed to determinate UID and GID"))
|
|
|
|
|
raise ClientError(_("Failed to resolve UID and GID"))
|
|
|
|
|
self.sync = self.clVars.Get('cl_client_sync') == 'on'
|
|
|
|
|
self.userName = self.clVars.Get("ur_login")
|
|
|
|
|
self.homeDir = self.clVars.Get('ur_home_path')
|
|
|
|
@ -1163,7 +1166,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
try:
|
|
|
|
|
pwdObj = pwd.getpwnam(self.userName)
|
|
|
|
|
except:
|
|
|
|
|
raise ClientError(_("Failed to found user %s")%self.userName)
|
|
|
|
|
raise ClientError(_("User %s not found")%self.userName)
|
|
|
|
|
self.printWARNING(_("User information from /etc/passwd is used"))
|
|
|
|
|
return True
|
|
|
|
|
# check for domain workstation and [remote] was mounted
|
|
|
|
@ -1188,7 +1191,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
raise ClientError(_("User password not found"))
|
|
|
|
|
# user cache
|
|
|
|
|
if not self.cAddUserToCache(self.userName, userPwd):
|
|
|
|
|
self.printWARNING(_("Unable cache user info"))
|
|
|
|
|
self.printWARNING(_("Unable to cache user info"))
|
|
|
|
|
# profile name
|
|
|
|
|
if self.clVars.Get("cl_profile_all_set") == "on":
|
|
|
|
|
osLinuxShort = "all"
|
|
|
|
@ -1251,7 +1254,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
_("Changings in the user profile will not "
|
|
|
|
|
"be saved to the domain"))
|
|
|
|
|
else:
|
|
|
|
|
self.printSUCCESS(_("Get a user profile from the %s domain")%
|
|
|
|
|
self.printSUCCESS(_("Get the user profile from domain %s")%
|
|
|
|
|
profileServer)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1278,12 +1281,12 @@ class Client(commandServer, encrypt):
|
|
|
|
|
except OSError:
|
|
|
|
|
self.printWARNING(_("Failed to remove %s")%filename)
|
|
|
|
|
except:
|
|
|
|
|
self.printWARNING(_("Failed to make links archive"))
|
|
|
|
|
self.printWARNING(_("Failed to make a links archive"))
|
|
|
|
|
try:
|
|
|
|
|
if os.path.exists(linkArch):
|
|
|
|
|
os.chown(linkArch,uid,gid)
|
|
|
|
|
except:
|
|
|
|
|
self.printWARNING(_("Failed to make links archive"))
|
|
|
|
|
self.printWARNING(_("Failed to make a links archive"))
|
|
|
|
|
|
|
|
|
|
def unpackLinks(self,userHome):
|
|
|
|
|
"""Unpack archive of symlinks"""
|
|
|
|
@ -1294,7 +1297,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
tf.extractall(userHome)
|
|
|
|
|
tf.close()
|
|
|
|
|
except:
|
|
|
|
|
self.printWARNING(_("Failed to unpack links archive"))
|
|
|
|
|
self.printWARNING(_("Failed to unpack the links archive"))
|
|
|
|
|
|
|
|
|
|
def moveHomeDir(self, userHome):
|
|
|
|
|
"""
|
|
|
|
@ -1465,7 +1468,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
# file list in user profile
|
|
|
|
|
listFiles = []
|
|
|
|
|
if not skipPaths:
|
|
|
|
|
self.printERROR(_("Mounting point for server resources not found"))
|
|
|
|
|
self.printERROR(_("Mounting point for server resource not found"))
|
|
|
|
|
return False
|
|
|
|
|
self.scanDirectory(homeDir, listFiles, skipPaths)
|
|
|
|
|
return listFiles
|
|
|
|
@ -1649,7 +1652,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
self.printERROR(_("Failed to remove dir %s")% pathDisks)
|
|
|
|
|
return False
|
|
|
|
|
if self.sync:
|
|
|
|
|
self.printSUCCESS(_("User profile saved in the domain"))
|
|
|
|
|
self.printSUCCESS(_("Modified user profile saved in the domain"))
|
|
|
|
|
self.setVarToConfig("main", {"status_sync":"success_logout"},
|
|
|
|
|
configFileName)
|
|
|
|
|
self.printSUCCESS(_("Domain user resource unmounted"))
|
|
|
|
@ -1707,7 +1710,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
if isMount(rpath):
|
|
|
|
|
raise ClientError(_("Failed to unmount path %s")%rpath)
|
|
|
|
|
raise ClientError(_("Failed to unmount directory %s")%rpath)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def umountUserRes(self, homeDir=False, removeEmpty=False):
|
|
|
|
@ -1778,17 +1781,17 @@ class Client(commandServer, encrypt):
|
|
|
|
|
# apply templates for undomain
|
|
|
|
|
self.clVars.Set("cl_action", "undomain", True)
|
|
|
|
|
if not self.applyTemplatesFromSystem():
|
|
|
|
|
self.printERROR(_("Failed to apply undomain templates"))
|
|
|
|
|
self.printERROR(_("Failed to apply non-domain templates"))
|
|
|
|
|
return False
|
|
|
|
|
# Delete LDAP users from system and clear cache
|
|
|
|
|
if not self.cDelLdapSysUsersAndClearCache():
|
|
|
|
|
self.printERROR(_("Failed to clear user cache"))
|
|
|
|
|
self.printERROR(_("Failed to clear the user cache"))
|
|
|
|
|
return False
|
|
|
|
|
# restart dbus
|
|
|
|
|
self.restartDBus()
|
|
|
|
|
if not self.delDaemonAutostart("client"):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Failed to remove client service from autostart"))
|
|
|
|
|
_("Failed to remove the client service from autostart"))
|
|
|
|
|
return False
|
|
|
|
|
self.printSUCCESS(_("Computer removed from domain %s")%domain + " ...")
|
|
|
|
|
return True
|
|
|
|
@ -2017,7 +2020,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
if hostAuth:
|
|
|
|
|
self.printERROR(_("Failed to apply domain templates"))
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Failed to apply undomain templates"))
|
|
|
|
|
self.printERROR(_("Failed to apply non-domain templates"))
|
|
|
|
|
return False
|
|
|
|
|
if hostAuth:
|
|
|
|
|
self.printSUCCESS(_("Templates set for network mode"))
|
|
|
|
@ -2173,7 +2176,7 @@ class Client(commandServer, encrypt):
|
|
|
|
|
if self.uid == 0:
|
|
|
|
|
self.printERROR(_("The user is root"))
|
|
|
|
|
self.printWARNING(\
|
|
|
|
|
_("The program can be executed for a non-root user only"))
|
|
|
|
|
_("The program can be executed by a non-root user only"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
password = self.clVars.Get('ur_user_new_pw')
|
|
|
|
|