<s> import logging , os <EOL> from datetime import datetime <EOL> from OpenMesher . interfaces import IOpenMesherConfigPlugin <EOL> class Quagga ( IOpenMesherConfigPlugin ) : <EOL> def activate ( self ) : <EOL> self . _register ( '<STR_LIT>' ) <EOL> self . _register ( '<STR_LIT>' ) <EOL> def setupargs ( self , parser ) : <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:store>' , help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:store>' , help = '<STR_LIT>' ) <EOL> super ( Quagga , self ) . setupargs ( parser ) <EOL> def process ( self , mesh , cliargs = None ) : <EOL> logging . debug ( '<STR_LIT>' ) <EOL> self . _quaggafiles = { } <EOL> for router in mesh . links : <EOL> self . _files [ router ] = { } <EOL> configtime = datetime . strftime ( datetime . now ( ) , '<STR_LIT>' ) <EOL> if cliargs . password and cliargs . enable_password : <EOL> zpw = cliargs . password <EOL> zepw = cliargs . enable_password <EOL> elif cliargs . password and not cliargs . enable_password : <EOL> zpw = cliargs . password <EOL> zepw = cliargs . password <EOL> elif cliargs . enable_password and not cliargs . password : <EOL> zp = cliargs . enable_password <EOL> zepw = cliargs . enable_password <EOL> else : <EOL> logging . warn ( "<STR_LIT>" % ( router ) ) <EOL> zpw = '<STR_LIT>' <EOL> zepw = '<STR_LIT>' <EOL> if '<STR_LIT:.>' in str ( router ) : <EOL> hostname = str ( router ) . split ( '<STR_LIT:.>' ) [ <NUM_LIT:0> ] <EOL> else : <EOL> self . hostname = str ( router ) <EOL> self . _files [ router ] [ '<STR_LIT>' ] = self . _templates [ '<STR_LIT>' ] . render ( <EOL> gentime = configtime , <EOL> password = zpw , <EOL> enablepassword = zepw , <EOL> hostname = hostname , <EOL> router = router , <EOL> ) <EOL> self . _files [ router ] [ '<STR_LIT>' ] = self . _templates [ '<STR_LIT>' ] . render ( <EOL> gentime = configtime , <EOL> password = zpw , <EOL> enablepassword = zepw , <EOL> hostname = hostname , <EOL> router = router , <EOL> links = mesh . links [ router ] <EOL> ) </s>
