mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 05:02:15 +03:00
merge fix
This commit is contained in:
commit
d69f743e29
4 changed files with 30 additions and 29 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
debian/ahenk/*
|
debian/ahenk/*
|
||||||
debian/ahenk
|
debian/ahenk
|
||||||
|
*.orig
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||||
|
|
||||||
from base.config.ConfigManager import ConfigManager
|
from base.config.ConfigManager import ConfigManager
|
||||||
from base.deamon.BaseDeamon import BaseDeamon
|
from base.deamon.BaseDeamon import BaseDeamon
|
||||||
from base.logger.AhenkLogger import AhenkLogger
|
from base.logging.AhenkLogger import Logger
|
||||||
from base.Scope import Scope
|
from base.Scope import Scope
|
||||||
#from base.messaging.Messaging import Messaging
|
#from base.messaging.Messaging import Messaging
|
||||||
import sys,logging
|
import sys,logging
|
||||||
|
@ -12,19 +12,11 @@ import sys,logging
|
||||||
|
|
||||||
class AhenkDeamon(BaseDeamon):
|
class AhenkDeamon(BaseDeamon):
|
||||||
"""docstring for AhenkDeamon"""
|
"""docstring for AhenkDeamon"""
|
||||||
globalscope=None
|
|
||||||
def __init__(self, arg):
|
|
||||||
super(AhenkDeamon, self).__init__()
|
|
||||||
self.arg = arg
|
|
||||||
global globalscope
|
|
||||||
globalscope=Scope()
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def scope():
|
|
||||||
return globalscope
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
global globalscope
|
globalscope = Scope()
|
||||||
|
globalscope.setInstance(globalscope)
|
||||||
|
|
||||||
configFilePath='/etc/ahenk/ahenk.conf'
|
configFilePath='/etc/ahenk/ahenk.conf'
|
||||||
configfileFolderPath='/etc/ahenk/config.d/'
|
configfileFolderPath='/etc/ahenk/config.d/'
|
||||||
|
|
||||||
|
@ -33,29 +25,26 @@ class AhenkDeamon(BaseDeamon):
|
||||||
config = configManager.read()
|
config = configManager.read()
|
||||||
globalscope.setConfigurationManager(config)
|
globalscope.setConfigurationManager(config)
|
||||||
|
|
||||||
#logger = AhenkLogger()
|
logger = Logger()
|
||||||
#logger.info("obaraaa")
|
logger.info("obaraaa")
|
||||||
#globalscope.setLogger(logger)
|
globalscope.setLogger(logger)
|
||||||
|
|
||||||
#messaging=Messaging()
|
|
||||||
#messaging.connectToServer()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print "hello"
|
|
||||||
print sys.path
|
|
||||||
"""
|
|
||||||
pidfilePath='/var/run/ahenk.pid'
|
pidfilePath='/var/run/ahenk.pid'
|
||||||
|
|
||||||
deamon = AhenkDeamon(pidfilePath)
|
ahenkdeamon = AhenkDeamon(pidfilePath)
|
||||||
|
|
||||||
|
print sys.argv
|
||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
if sys.argv[1] == "start":
|
if sys.argv[1] == "start":
|
||||||
deamon.start()
|
print "starting"
|
||||||
|
ahenkdeamon.start()
|
||||||
elif sys.argv[1] == 'stop':
|
elif sys.argv[1] == 'stop':
|
||||||
deamon.stop()
|
ahenkdeamon.stop()
|
||||||
elif sys.argv[1] == 'restart':
|
elif sys.argv[1] == 'restart':
|
||||||
deamon.restart()
|
ahenkdeamon.restart()
|
||||||
elif sys.argv[1] == 'status':
|
elif sys.argv[1] == 'status':
|
||||||
# print status
|
# print status
|
||||||
pass
|
pass
|
||||||
|
@ -66,4 +55,3 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
print 'Usage : %s start|stop|restart|status' % sys.argv[0]
|
print 'Usage : %s start|stop|restart|status' % sys.argv[0]
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
"""
|
|
||||||
|
|
|
@ -5,12 +5,24 @@
|
||||||
|
|
||||||
class Scope(object):
|
class Scope(object):
|
||||||
"""docstring for Scope"""
|
"""docstring for Scope"""
|
||||||
|
|
||||||
|
scopeInstance=None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Scope, self).__init__()
|
super(Scope, self).__init__()
|
||||||
self.customMap = {}
|
self.customMap = {}
|
||||||
self.configurationManager=None
|
self.configurationManager=None
|
||||||
self.logger=None
|
self.logger=None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getInstance():
|
||||||
|
return scopeInstance
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def setInstance(scopeObj):
|
||||||
|
global scopeInstance
|
||||||
|
scopeInstance = scopeObj
|
||||||
|
|
||||||
def getCustomMap(self):
|
def getCustomMap(self):
|
||||||
return self.customMap
|
return self.customMap
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@ import sys
|
||||||
sys.path.append('../..')
|
sys.path.append('../..')
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
from ahenkd import AhenkDeamon
|
from base.Scope import Scope
|
||||||
|
|
||||||
class AhenkLogger(object):
|
class AhenkLogger(object):
|
||||||
"""docstring for Logger"""
|
"""docstring for Logger"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Logger, self).__init__()
|
super(Logger, self).__init__()
|
||||||
scope = AhenkDeamon.scope()
|
scope = Scope.getInstance()
|
||||||
configManager = scope.getConfigurationManager()
|
configManager = scope.getConfigurationManager()
|
||||||
|
|
||||||
logging.config.fileConfig(configManager.get('BASE','logConfigurationFilePath'))
|
logging.config.fileConfig(configManager.get('BASE','logConfigurationFilePath'))
|
||||||
|
|
Loading…
Reference in a new issue