Commit 87fc2ea1 authored by hardy's avatar hardy

fix private method

parent dda388e6
...@@ -66,11 +66,8 @@ class Log_Mgt: ...@@ -66,11 +66,8 @@ class Log_Mgt:
tmp=s.split() tmp=s.split()
return tmp[8]#return filename from the line return tmp[8]#return filename from the line
#-----------------$
#PUBLIC Methods$
#-----------------$
def AvgSize(self): def __AvgSize(self):
HOST=self.IPAddress HOST=self.IPAddress
COMMAND="ls -rtl "+ self.path COMMAND="ls -rtl "+ self.path
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
...@@ -83,9 +80,14 @@ class Log_Mgt: ...@@ -83,9 +80,14 @@ class Log_Mgt:
return math.floor(total_size/(len(result)-1)) #compute average file/artifact size return math.floor(total_size/(len(result)-1)) #compute average file/artifact size
#-----------------$
#PUBLIC Methods$
#-----------------$
def LogRotation(self): def LogRotation(self):
avail_space =int(self.__CheckAvailSpace())*1000 #avail space in target folder, initially displayed in Gb avail_space =int(self.__CheckAvailSpace())*1000 #avail space in target folder, initially displayed in Gb
avg_size=self.AvgSize() #average size of artifacts in the target folder avg_size=self.__AvgSize() #average size of artifacts in the target folder
logging.debug("Avail Space : " + str(avail_space) + " / Artifact Avg Size : " + str(avg_size)) logging.debug("Avail Space : " + str(avail_space) + " / Artifact Avg Size : " + str(avg_size))
if avail_space < 2*avg_size: #reserved space is 2x artifact file ; oldest file will be deleted if avail_space < 2*avg_size: #reserved space is 2x artifact file ; oldest file will be deleted
oldestfile=self.__GetOldestFile() oldestfile=self.__GetOldestFile()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment