@ -43,27 +43,38 @@ class ActionReader(DefinitionInitConfigReader):
[ " string " , " actionunban " , " " ] ,
[ " string " , " actionunban " , " " ] ,
]
]
def __init__ ( self , file_ , jailName , initOpts , * * kwargs ) :
self . _name = initOpts . get ( " actname " , file_ )
DefinitionInitConfigReader . __init__ (
self , file_ , jailName , initOpts , * * kwargs )
def setName ( self , name ) :
self . _name = name
def getName ( self ) :
return self . _name
def read ( self ) :
def read ( self ) :
return ConfigReader . read ( self , os . path . join ( " action.d " , self . _file ) )
return ConfigReader . read ( self , os . path . join ( " action.d " , self . _file ) )
def convert ( self ) :
def convert ( self ) :
head = [ " set " , self . _name ]
head = [ " set " , self . _ jailN ame]
stream = list ( )
stream = list ( )
stream . append ( head + [ " addaction " , self . _file ] )
stream . append ( head + [ " addaction " , self . _ nam e] )
for opt in self . _opts :
for opt in self . _opts :
if opt == " actionstart " :
if opt == " actionstart " :
stream . append ( head + [ " actionstart " , self . _file , self . _opts [ opt ] ] )
stream . append ( head + [ " actionstart " , self . _ nam e, self . _opts [ opt ] ] )
elif opt == " actionstop " :
elif opt == " actionstop " :
stream . append ( head + [ " actionstop " , self . _ fil e, self . _opts [ opt ] ] )
stream . append ( head + [ " actionstop " , self . _ nam e, self . _opts [ opt ] ] )
elif opt == " actioncheck " :
elif opt == " actioncheck " :
stream . append ( head + [ " actioncheck " , self . _ fil e, self . _opts [ opt ] ] )
stream . append ( head + [ " actioncheck " , self . _ nam e, self . _opts [ opt ] ] )
elif opt == " actionban " :
elif opt == " actionban " :
stream . append ( head + [ " actionban " , self . _ fil e, self . _opts [ opt ] ] )
stream . append ( head + [ " actionban " , self . _ nam e, self . _opts [ opt ] ] )
elif opt == " actionunban " :
elif opt == " actionunban " :
stream . append ( head + [ " actionunban " , self . _ fil e, self . _opts [ opt ] ] )
stream . append ( head + [ " actionunban " , self . _ nam e, self . _opts [ opt ] ] )
# cInfo
# cInfo
if self . _initOpts :
if self . _initOpts :
for p in self . _initOpts :
for p in self . _initOpts :
stream . append ( head + [ " setcinfo " , self . _ fil e, p , self . _initOpts [ p ] ] )
stream . append ( head + [ " setcinfo " , self . _ nam e, p , self . _initOpts [ p ] ] )
return stream
return stream