|
|
|
@ -15,7 +15,7 @@ from threading import Thread
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
from monitor import ProcessCounter
|
|
|
|
|
from utils.transport import QueueListener, QueueWriter, QueueReader
|
|
|
|
|
from utils.params import PARAMS
|
|
|
|
@ -37,7 +37,7 @@ class Actor():
|
|
|
|
|
o = eval("".join([name,"()"]))
|
|
|
|
|
o.init(args)
|
|
|
|
|
except Exception,e:
|
|
|
|
|
print e
|
|
|
|
|
print str(e)
|
|
|
|
|
return o
|
|
|
|
|
def __init__(self):
|
|
|
|
|
"""
|
|
|
|
@ -55,8 +55,6 @@ class Actor():
|
|
|
|
|
def init(self,args):
|
|
|
|
|
self.config = args
|
|
|
|
|
|
|
|
|
|
def process(self,item):
|
|
|
|
|
pass
|
|
|
|
|
def isValid(self,item):
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -153,7 +151,7 @@ class Mailer (Actor):
|
|
|
|
|
# If not authenticated the preconditions have failed
|
|
|
|
|
#
|
|
|
|
|
except Exception,e:
|
|
|
|
|
print e
|
|
|
|
|
print str(e)
|
|
|
|
|
self.handler = None
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
@ -184,8 +182,8 @@ class Folders(Actor):
|
|
|
|
|
@params threshold in terms of size, or age. It will be applied to all folders
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def init(self,**args):
|
|
|
|
|
Actor.init(self)
|
|
|
|
|
def init(self,args):
|
|
|
|
|
Actor.init(self,args)
|
|
|
|
|
#self.lfolders = args['folders'] #config['folders']
|
|
|
|
|
#self.action = args['action'] #{clear,archive} config['actions']['folders']
|
|
|
|
|
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
|
|
|
|
|
"""
|
|
|
|
|
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:
|
|
|
|
|
return -1
|
|
|
|
|
key = key.pop()
|
|
|
|
|