mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-12-03 19:52:16 +03:00
added logrotate for ahenk log and delete ahenk list source file on packages.py
This commit is contained in:
parent
9602b41284
commit
de88b17719
5 changed files with 17 additions and 7 deletions
|
@ -12,7 +12,7 @@ keys=file
|
|||
class=logging.FileHandler
|
||||
level=DEBUG
|
||||
formatter=default
|
||||
args=("/var/log/ahenk.log", "w")
|
||||
args=("/var/log/ahenk.log", "a")
|
||||
|
||||
[loggers]
|
||||
keys=root
|
||||
|
|
|
@ -12,7 +12,7 @@ keys=file
|
|||
class=logging.FileHandler
|
||||
level=DEBUG
|
||||
formatter=default
|
||||
args=("/var/log/ahenk.log", "w")
|
||||
args=("/var/log/ahenk.log", "a")
|
||||
|
||||
[loggers]
|
||||
keys=root
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/var/log/ahenk.log {
|
||||
weekly
|
||||
daily
|
||||
missingok
|
||||
notifempty
|
||||
rotate 5
|
||||
rotate 10
|
||||
compress
|
||||
delaycompress
|
||||
copytruncate
|
||||
minsize 1000k
|
||||
create 0766 root root
|
||||
}
|
|
@ -47,7 +47,7 @@ class DeleteNetwork(AbstractPlugin):
|
|||
self.content = '#auto {0}\n'.format(self.name)
|
||||
|
||||
if line.startswith(self.content):
|
||||
counter = 3
|
||||
counter = 4
|
||||
else:
|
||||
print(str(line).strip())
|
||||
|
||||
|
|
|
@ -97,18 +97,24 @@ class Packages(AbstractPlugin):
|
|||
message='{0}\n Paket kaldırılırken '
|
||||
'hata oluştu. Hata Mesajı: {1}'.format(
|
||||
cn, str(p_err)))
|
||||
|
||||
|
||||
except Exception as e:
|
||||
self.logger.error('Unpredictable error exists. Error Message: {0}'.format(str(e)))
|
||||
self.delete_source_file()
|
||||
self.context.create_response(code=self.message_code.TASK_ERROR.value,
|
||||
message='{0}.\nÖngörülemeyen bir hata oluştu.Hata mesajı:{1}'.format(
|
||||
cn, str(e)))
|
||||
return
|
||||
|
||||
self.delete_source_file()
|
||||
|
||||
self.logger.debug('Task handled successfully')
|
||||
self.context.create_response(code=self.message_code.TASK_PROCESSED.value,
|
||||
message='{0} ahenginde, {1} paketi({2}) {3} işlemi başarı ile gerçekleştirildi.'.format(cn,item['packageName'], item['version'], item['tag']))
|
||||
except Exception as e:
|
||||
self.logger.error('Unpredictable error exists. Error Message: {0}'.format(str(e)))
|
||||
self.delete_source_file()
|
||||
self.context.create_response(code=self.message_code.TASK_ERROR.value,
|
||||
message='{0}\nGörev çalıştırılırken beklenmedik bir hata oluştu. Hata Mesajı: {1}'.format(
|
||||
cn,
|
||||
|
@ -127,6 +133,11 @@ class Packages(AbstractPlugin):
|
|||
def add_source(self, source):
|
||||
self.write_file('/etc/apt/sources.list.d/ahenk.list', source+'\n', 'a+')
|
||||
|
||||
def delete_source_file(self):
|
||||
if self.is_exist('/etc/apt/sources.list.d/ahenk.list'):
|
||||
self.delete_file('/etc/apt/sources.list.d/ahenk.list')
|
||||
self.logger.info("Delete ahenk.list source file")
|
||||
|
||||
|
||||
def handle_task(task, context):
|
||||
plugin = Packages(task, context)
|
||||
|
|
Loading…
Reference in a new issue