|
|
|
@ -2055,22 +2055,35 @@ you need to remove it from the previous domain"))
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def copyHomeDirs(self):
|
|
|
|
|
def moveHomeDirs(self):
|
|
|
|
|
"""Move home dirs /var/calculate/client-home -> /home
|
|
|
|
|
|
|
|
|
|
if user in cache
|
|
|
|
|
"""
|
|
|
|
|
cacheObj = userCache()
|
|
|
|
|
loginUsersData = cacheObj.getLoginDomainUsers()
|
|
|
|
|
if loginUsersData is False:
|
|
|
|
|
return False
|
|
|
|
|
previousHome = "/var/calculate/client-home"
|
|
|
|
|
if isMount(previousHome):
|
|
|
|
|
return True
|
|
|
|
|
flagMovedUsers = False
|
|
|
|
|
if os.path.exists(previousHome):
|
|
|
|
|
for userName,x,uid,gid,gecos,directory,shell in loginUsersData:
|
|
|
|
|
homeDir = directory
|
|
|
|
|
pathUser ="/".join(filter(lambda x: x, directory.split('/'))[1:])
|
|
|
|
|
pathUserList = filter(lambda x: x, directory.split('/'))
|
|
|
|
|
if not pathUserList:
|
|
|
|
|
continue
|
|
|
|
|
pathUser = "/".join(pathUserList[1:])
|
|
|
|
|
srcDir = pathJoin(previousHome, pathUser)
|
|
|
|
|
if os.path.exists(srcDir) and not os.path.exists(homeDir):
|
|
|
|
|
flagMovedUsers = True
|
|
|
|
|
destDir = os.path.dirname(homeDir)
|
|
|
|
|
self.printWARNING(_("Moved %(src)s to %(dest)s")\
|
|
|
|
|
%{"src":srcDir,"dest":homeDir})
|
|
|
|
|
if not self.copyTemplateDir(srcDir, destDir):
|
|
|
|
|
return False
|
|
|
|
|
if not os.listdir(previousHome):
|
|
|
|
|
if flagMovedUsers and not os.listdir(previousHome):
|
|
|
|
|
os.rmdir(previousHome)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -2124,7 +2137,7 @@ you need to remove it from the previous domain"))
|
|
|
|
|
return False
|
|
|
|
|
if not self.cAddCacheUsersFromSystem():
|
|
|
|
|
return False
|
|
|
|
|
if not self.copyHomeDirs():
|
|
|
|
|
if not self.moveHomeDirs():
|
|
|
|
|
return False
|
|
|
|
|
if beforeRemoteAuth != self.clVars.Get('os_remote_auth'):
|
|
|
|
|
self.restartDBus()
|
|
|
|
|