[gestion/hptools.py] PasDésautomatisation de la requête ldap lors de la création d'une classe snmp
darcs-hash:20100211120238-bd074-1ff13de72abc96c36dbda7ad6b446316d8a8da87.gz
This commit is contained in:
parent
2b2226644a
commit
58d7b76ea3
1 changed files with 10 additions and 9 deletions
|
@ -124,15 +124,6 @@ class snmp :
|
||||||
self.host = host
|
self.host = host
|
||||||
self.version = version
|
self.version = version
|
||||||
|
|
||||||
try:
|
|
||||||
self._machine = cl.search("host=%(host)s" % {'host': host})["machineCrans"][0]
|
|
||||||
except IndexError:
|
|
||||||
raise ValueError(u"Cette machine n'est pas un switch du Cr@ns : %s" % host)
|
|
||||||
|
|
||||||
# l'engineid du switch n'est que sa mac avec quelques fioritures autour...
|
|
||||||
mac = self._machine.mac().replace(':', '')
|
|
||||||
self._engineid = '0000000b0000%(mac)s0' % {'mac': mac[:-1]}
|
|
||||||
|
|
||||||
if version == '1' or version == '2c' :
|
if version == '1' or version == '2c' :
|
||||||
self.options = "-v %s -c '%s' %s " % ( version, community, host )
|
self.options = "-v %s -c '%s' %s " % ( version, community, host )
|
||||||
elif version =='3' :
|
elif version =='3' :
|
||||||
|
@ -143,6 +134,16 @@ class snmp :
|
||||||
else :
|
else :
|
||||||
raise ValueError('Version incorrecte')
|
raise ValueError('Version incorrecte')
|
||||||
|
|
||||||
|
def __init_ldap(self):
|
||||||
|
try:
|
||||||
|
self._machine = cl.search("host=%(host)s" % {'host': self.host})["machineCrans"][0]
|
||||||
|
except IndexError:
|
||||||
|
raise ValueError(u"Cette machine n'est pas un switch du Cr@ns : %s" % host)
|
||||||
|
|
||||||
|
# l'engineid du switch n'est que sa mac avec quelques fioritures autour...
|
||||||
|
mac = self._machine.mac().replace(':', '')
|
||||||
|
self._engineid = '0000000b0000%(mac)s0' % {'mac': mac[:-1]}
|
||||||
|
|
||||||
def __exec(self,cmd) :
|
def __exec(self,cmd) :
|
||||||
s, r = getstatusoutput(cmd)
|
s, r = getstatusoutput(cmd)
|
||||||
if s :
|
if s :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue