CO - bug fix folders actor

community
Gogs 7 years ago
parent 6ba4f52c35
commit e8dce098ec

@ -15,7 +15,7 @@ from threading import Thread
import os import os
import shutil import shutil
import subprocess import subprocess
import re
from monitor import ProcessCounter from monitor import ProcessCounter
from utils.transport import QueueListener, QueueWriter, QueueReader from utils.transport import QueueListener, QueueWriter, QueueReader
from utils.params import PARAMS from utils.params import PARAMS
@ -37,7 +37,7 @@ class Actor():
o = eval("".join([name,"()"])) o = eval("".join([name,"()"]))
o.init(args) o.init(args)
except Exception,e: except Exception,e:
print e print str(e)
return o return o
def __init__(self): def __init__(self):
""" """
@ -55,8 +55,6 @@ class Actor():
def init(self,args): def init(self,args):
self.config = args self.config = args
def process(self,item):
pass
def isValid(self,item): def isValid(self,item):
return False return False
@ -153,7 +151,7 @@ class Mailer (Actor):
# If not authenticated the preconditions have failed # If not authenticated the preconditions have failed
# #
except Exception,e: except Exception,e:
print e print str(e)
self.handler = None self.handler = None
pass pass
@ -184,8 +182,8 @@ class Folders(Actor):
@params threshold in terms of size, or age. It will be applied to all folders @params threshold in terms of size, or age. It will be applied to all folders
""" """
def init(self,**args): def init(self,args):
Actor.init(self) Actor.init(self,args)
#self.lfolders = args['folders'] #config['folders'] #self.lfolders = args['folders'] #config['folders']
#self.action = args['action'] #{clear,archive} config['actions']['folders'] #self.action = args['action'] #{clear,archive} config['actions']['folders']
self.threshold = self.get_size( args['threshold']) #self.config['threshold']) self.threshold = self.get_size( args['threshold']) #self.config['threshold'])
@ -228,7 +226,7 @@ class Folders(Actor):
converts size values into MB and returns the value without units converts size values into MB and returns the value without units
""" """
units = {'MB':1000,'GB':1000000,'TB':1000000000} # converting to kb units = {'MB':1000,'GB':1000000,'TB':1000000000} # converting to kb
key = set(unites) & set(re.split('(\d+)',value.upper())) key = set(units) & set(re.split('(\d+)',value.upper()))
if len(key) == 0: if len(key) == 0:
return -1 return -1
key = key.pop() key = key.pop()

Loading…
Cancel
Save