Revisión 211
Añadido por Manu Mora Gordillo hace más de 13 años
controlies/trunk/applications/controlies/modules/Hosts.py | ||
---|---|---|
self.ip = ip
|
||
self.mac = mac
|
||
self.type_host = type_host
|
||
|
||
def getName (self):
|
||
return self.mac
|
||
|
||
|
||
def validation(self,action):
|
||
|
||
if action == "add":
|
||
... | ... | |
if self.existsMAC():
|
||
return "macAlreadyExists"
|
||
|
||
elif action == "modify":
|
||
elif action == "modify":
|
||
if self.groupOverflow(300):
|
||
return "groupOverflow"
|
||
|
||
if self.existsMAC():
|
||
return "macAlreadyExists"
|
||
if not self.equalIP():
|
||
if self.existsIP():
|
||
return "ipAlreadyExists"
|
||
|
||
return "OK"
|
||
|
||
if not self.equalMAC():
|
||
if self.existsMAC():
|
||
return "macAlreadyExists"
|
||
|
||
return "OK"
|
||
|
||
def process(self,action):
|
||
|
||
if action == "add":
|
||
... | ... | |
|
||
if action == "list":
|
||
response = self.list();
|
||
return response
|
||
return response
|
||
|
||
def list(self,args):
|
||
|
||
... | ... | |
return "OK"
|
||
|
||
def modify(self):
|
||
# Hosts
|
||
attr = [
|
||
(ldap.MOD_REPLACE, 'cn', [self.name] ),
|
||
(ldap.MOD_REPLACE, 'dhcpHWAddress', ["ethernet "+ self.mac])
|
||
(ldap.MOD_REPLACE, 'ipHostNumber', [self.ip] ),
|
||
(ldap.MOD_REPLACE, 'macAddress', [self.mac])
|
||
]
|
||
|
||
self.ldap.modify("cn="+self.name+",cn="+self.group +",cn=THINCLIENTS,cn=DHCP Config", attr)
|
||
self.ldap.modify("cn="+self.name+",ou=Hosts", attr)
|
||
|
||
# Hosts->domain
|
||
attr = [(ldap.MOD_REPLACE, 'aRecord', [self.ip] )]
|
||
self.ldap.modify("dc="+self.name+",dc=santaeulalia,ou=Hosts", attr)
|
||
|
||
# DHCP Config
|
||
attr = [(ldap.MOD_REPLACE, 'dhcpHWAddress', [self.mac] )]
|
||
self.ldap.modify("cn="+self.name+",cn=group1,cn=INTERNAL,cn=DHCP Config", attr)
|
||
|
||
return "OK"
|
||
|
||
def delete(self):
|
||
... | ... | |
return True
|
||
|
||
return False
|
||
|
||
|
||
|
||
def existsIP (self):
|
||
# Cojo las ips de la rama hosts -> arpa -> in-addr
|
||
result = self.ldap.search ("dc=23,dc=172,dc=in-addr,dc=arpa,ou=hosts", "dc=*",["associatedDomain"])
|
||
... | ... | |
return True
|
||
|
||
return False
|
||
|
||
def equalMAC(self):
|
||
result = self.ldap.search("ou=hosts","cn="+self.name,["macAddress"])
|
||
if result[0][0][1]['macAddress'][0] == self.mac:
|
||
return True
|
||
|
||
return False
|
||
|
||
def equalIP(self):
|
||
result = self.ldap.search("ou=hosts","cn="+self.name,["ipHostNumber"])
|
||
if result[0][0][1]['ipHostNumber'][0] == self.ip:
|
||
return True
|
||
|
||
return False
|
||
|
||
|
||
def getName (self):
|
||
return self.mac
|
||
|
||
def getThinclientGroups (self):
|
||
|
||
groups = []
|
controlies/trunk/applications/controlies/views/usuarios/index.html | ||
---|---|---|
{{#response.files.append(URL('static','css/dropdown.css'))}}
|
||
{{#response.files.append(URL('static','css/default.advanced.css'))}}
|
||
|
||
|
||
|
||
|
||
|
||
{{extend 'layout.html'}}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div id="tabla_clientes" class="centerGrid">
|
||
<table width="100%" align="center">
|
||
<tr>
|
Exportar a: Unified diff
Ya modifica LTSP