Changeset 1740 for pykota/trunk/bin

Show
Ignore:
Timestamp:
09/23/04 21:29:36 (20 years ago)
Author:
jalet
Message:

If SNMP accounting is possible, pkhint now suggests to use the internal
SNMP handling instead of the external one. No real test is done for now,
though.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkhint

    r1652 r1740  
    2424# 
    2525# $Log$ 
     26# Revision 1.17  2004/09/23 19:29:36  jalet 
     27# If SNMP accounting is possible, pkhint now suggests to use the internal 
     28# SNMP handling instead of the external one. No real test is done for now, 
     29# though. 
     30# 
    2631# Revision 1.16  2004/07/27 21:50:29  jalet 
    2732# Small fix for %(port)s thanks to rpinheiro 
     
    8691from pykota.config import PyKotaConfigError 
    8792from pykota.storage import PyKotaStorageError 
     93try : 
     94    import pysnmp 
     95except ImportError :     
     96    hasSNMP = 0 
     97else :     
     98    hasSNMP = 1 
    8899 
    89100__doc__ = """pkhint v%s (c) 2003-2004 C@LL - Conseil Internet & Logiciels Libres 
     
    246257                        port = 9100             # TODO : may cause problems with other protocols. 
    247258                         
     259                         
    248260                    snmpcommand = self.accepts(SNMPTESTS, hostname) 
    249261                    if snmpcommand is not None : 
    250                         accounter = 'hardware(/usr/share/pykota/waitprinter.sh %(printer)s && ' + snmpcommand + ')' 
     262                        if hasSNMP : 
     263                            # don't do a more complex test, just consider it will work 
     264                            accounter = 'hardware(snmp)' 
     265                        else :     
     266                            accounter = 'hardware(/usr/share/pykota/waitprinter.sh %(printer)s && ' + snmpcommand + ')' 
    251267                        configuration.append((printer, accounter)) 
    252268                    else :