Отмена опции '-s' у cl_client

git-svn-id: http://svn.calculate.ru/calculate2/calculate-client/trunk@626 c91db197-33c1-4113-bf15-f8a5c547ca64
develop
asamoukin 16 years ago
parent 7eca4a2029
commit 1b16fb56f6

@ -156,7 +156,7 @@ class cl_client(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
'longOption':"vars", 'longOption':"vars",
'optVal':_("TYPE_VAR"), 'optVal':_("TYPE_VAR"),
'helpChapter':_("Common options"), 'helpChapter':_("Common options"),
'help':_("print variables (TYPE_VAR=all' - print full var)") 'help':_("print variables (TYPE_VAR - all:full var)")
}, },
{'progAccess':(0,1,2), {'progAccess':(0,1,2),
'longOption':"color", 'longOption':"color",
@ -176,12 +176,6 @@ WHEN may be 'never', 'always', or 'auto'")
'helpChapter':_("Common options"), 'helpChapter':_("Common options"),
'help':_("mount [remote] resource for Samba (calculate-server)") 'help':_("mount [remote] resource for Samba (calculate-server)")
}, },
{'progAccess':(0,),
'shortOption':"s",
'longOption':"save",
'helpChapter':_("Common options"),
'help':_("save passwords domain, if you run with option '-r'")
},
{'progAccess':(2,), {'progAccess':(2,),
'longOption':"login", 'longOption':"login",
'helpChapter':_("Common options"), 'helpChapter':_("Common options"),
@ -492,12 +486,8 @@ conjunction with the 'login' or 'logout'")
self.createClVars() self.createClVars()
uidGid = False uidGid = False
# Подсоединяемся к серверу # Подсоединяемся к серверу
domain = False domain = self.clVars.Get("cl_remote_host")
connectLdap = False connectLdap = False
foundMountRemote = self.isMount("/var/calculate/remote" ,"cifs")
foundMountHome = self.isMount("/var/calculate/home" ,"none", False)
if foundMountRemote and foundMountHome:
domain = self.clVars.Get("cl_remote_host")
if domain: if domain:
if not self.getLdapObjBind(domain): if not self.getLdapObjBind(domain):
return False return False
@ -555,10 +545,10 @@ conjunction with the 'login' or 'logout'")
def isDomain(self): def isDomain(self):
"""Находится ли компьютер в домене""" """Находится ли компьютер в домене"""
self.createClVars(self.clVars) self.createClVars(self.clVars)
foundMountRemote = self.isMount("/var/calculate/remote" ,"cifs") foundMountRemote =self.isMount("/var/calculate/remote" ,"cifs")
foundMountHome = self.isMount("/var/calculate/home" ,"none", False) foundMountHome =self.isMount("/var/calculate/home" ,"none", False)
if not (self.clVars.Get("cl_remote_host") and foundMountRemote and\ if not (self.clVars.Get("cl_remote_host") and foundMountRemote and\
foundMountHome): foundMountHome):
self.printERROR("The computer is not in domain") self.printERROR("The computer is not in domain")
return False return False
return (foundMountRemote,foundMountHome) return (foundMountRemote,foundMountHome)
@ -628,7 +618,7 @@ cl_remote_pw") + " ...")
" ...") " ...")
return True return True
def delDomain(self, removePwd=True): def delDomain(self):
"""выводим из домена""" """выводим из домена"""
self.createClVars() self.createClVars()
pathRemote = "/var/calculate/remote" pathRemote = "/var/calculate/remote"
@ -654,12 +644,8 @@ cl_remote_pw") + " ...")
" ...") " ...")
return False return False
self.execProg("calculate -P install/6intranet") self.execProg("calculate -P install/6intranet")
if removePwd: self.clVars.Delete("cl_remote_host","local")
self.clVars.Delete("cl_remote_host","local") self.clVars.Delete("cl_remote_pw","local")
self.clVars.Delete("cl_remote_pw","local")
else:
self.printWARNING(_("remote domain address and remote password \
are not removed"))
self.printOK(_("Computer removed from domain %s")%domain + " ...") self.printOK(_("Computer removed from domain %s")%domain + " ...")
return True return True
@ -691,24 +677,17 @@ are not removed"))
if not foudHostSamba: if not foudHostSamba:
self.printERROR(_("Not found Samba server in %s")%domain) self.printERROR(_("Not found Samba server in %s")%domain)
return False return False
userPwd = False
if self.clVars.Get("cl_remote_host") and \ if self.clVars.Get("cl_remote_host") and \
self.clVars.Get("cl_remote_host") != domain: self.clVars.Get("cl_remote_host") != domain:
if not self.delDomain(): if not self.delDomain():
return False return False
# Создаем объект переменных (обновление переменных)
self.createClVars()
pwd = self.clVars.Get("cl_remote_pw")
if pwd:
userPwd = pwd
foundMountRemote =self.isMount("/var/calculate/remote" ,"cifs") foundMountRemote =self.isMount("/var/calculate/remote" ,"cifs")
foundMountHome =self.isMount("/var/calculate/home" ,"none", False) foundMountHome =self.isMount("/var/calculate/home" ,"none", False)
if foundMountRemote: if foundMountRemote:
self.printWARNING(_("Samba resource [remote] mount") + \ self.printWARNING(_("Samba resource [remote] mount") + \
" ...") " ...")
else: else:
if not userPwd: userPwd = self.getUserPassword("Domain password for the desktop")
userPwd=self.getUserPassword("Domain password for the desktop")
pathRemote = "/var/calculate/remote" pathRemote = "/var/calculate/remote"
pwdRemote = userPwd pwdRemote = userPwd
if not os.path.exists(pathRemote): if not os.path.exists(pathRemote):
@ -767,9 +746,7 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
"""Отмонтирование пользовательских ресурсов и синхронизация настроек""" """Отмонтирование пользовательских ресурсов и синхронизация настроек"""
self.createClVars() self.createClVars()
# В случае компьютера вне домена # В случае компьютера вне домена
foundMountRemote = self.isMount("/var/calculate/remote" ,"cifs") if not self.clVars.Get("cl_remote_host"):
foundMountHome = self.isMount("/var/calculate/home" ,"none", False)
if not (foundMountRemote and foundMountHome):
self.printSUCCESS(_("To be used by local profile.")) self.printSUCCESS(_("To be used by local profile."))
return True return True
connectDomain = self.isDomain() connectDomain = self.isDomain()
@ -829,9 +806,7 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
без синхронизации настроек""" без синхронизации настроек"""
self.createClVars(self.clVars) self.createClVars(self.clVars)
# В случае компьютера вне домена # В случае компьютера вне домена
foundMountRemote = self.isMount("/var/calculate/remote" ,"cifs") if not self.clVars.Get("cl_remote_host"):
foundMountHome = self.isMount("/var/calculate/home" ,"none", False)
if not (foundMountRemote and foundMountHome):
self.printSUCCESS(_("To be used by local profile.")) self.printSUCCESS(_("To be used by local profile."))
return True return True
# Подсоединяемся к серверу # Подсоединяемся к серверу
@ -876,9 +851,7 @@ install/6intranet" %(domain,servDn,unixDN,bindDn,bindPw)
"""Монтирование пользовательских ресурсов и синхронизация настроек""" """Монтирование пользовательских ресурсов и синхронизация настроек"""
self.createClVars() self.createClVars()
# В случае компьютера вне домена # В случае компьютера вне домена
foundMountRemote = self.isMount("/var/calculate/remote" ,"cifs") if not self.clVars.Get("cl_remote_host"):
foundMountHome = self.isMount("/var/calculate/home" ,"none", False)
if not (foundMountRemote and foundMountHome):
self.printSUCCESS(_("To be used by local profile.")) self.printSUCCESS(_("To be used by local profile."))
return True return True
# Проверим что компьютер в домене и смонтирован [remote] # Проверим что компьютер в домене и смонтирован [remote]

@ -50,18 +50,12 @@ if __name__ == "__main__":
cl_client.cl_client,object), cl_client.cl_client,object),
{}) {})
ldapObj = newClass("cl-client") ldapObj = newClass("cl-client")
if optObj.opt.has_key('s') and not optObj.opt.has_key('r'):
optObj.handlerErrOpt()
sys.exit(1)
if optObj.params.has_key('user'): if optObj.params.has_key('user'):
if not optObj.opt.has_key('r') or not optObj.opt.has_key('mount'): if not optObj.opt.has_key('r') or not optObj.opt.has_key('mount'):
domain = optObj.params['user'] domain = optObj.params['user']
if not ldapObj.addDomain(domain): if not ldapObj.addDomain(domain):
flagError = True flagError = True
elif optObj.opt.has_key('r') and optObj.opt.has_key('r'): if optObj.opt.has_key('r'):
if not ldapObj.delDomain(False):
flagError = True
elif optObj.opt.has_key('r'):
if not ldapObj.delDomain(): if not ldapObj.delDomain():
flagError = True flagError = True
elif optObj.opt.has_key('mount'): elif optObj.opt.has_key('mount'):

Loading…
Cancel
Save