mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 20:12:20 +03:00
ahenk start process was fixed depends to previous commits(merging messaging)
This commit is contained in:
parent
bfeb41c1e1
commit
98c02648f8
1 changed files with 29 additions and 16 deletions
|
@ -8,16 +8,15 @@ from base.deamon.BaseDeamon import BaseDaemon
|
||||||
from base.logger.AhenkLogger import Logger
|
from base.logger.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
|
||||||
from base.messaging.MessageReceiver import MessageReceiver
|
from base.messaging.Messager import Messager
|
||||||
from base.messaging.MessageSender import MessageSender
|
|
||||||
from base.execution.ExecutionManager import ExecutionManager
|
from base.execution.ExecutionManager import ExecutionManager
|
||||||
from base.registration.Registration import Registration
|
from base.registration.Registration import Registration
|
||||||
from base.messaging.MessageResponseQueue import MessageResponseQueue
|
from base.messaging.MessageResponseQueue import MessageResponseQueue
|
||||||
from base.event.EventManager import EventManager
|
from base.event.EventManager import EventManager
|
||||||
from base.plugin.PluginManager import PluginManager
|
from base.plugin.PluginManager import PluginManager
|
||||||
from base.task.TaskManager import TaskManager
|
from base.task.TaskManager import TaskManager
|
||||||
from multiprocessing import Process
|
from base.database.AhenkDbService import AhenkDbService
|
||||||
import sys
|
import threading,time,sys
|
||||||
|
|
||||||
|
|
||||||
class AhenkDeamon(BaseDaemon):
|
class AhenkDeamon(BaseDaemon):
|
||||||
|
@ -50,6 +49,12 @@ class AhenkDeamon(BaseDaemon):
|
||||||
globalscope.setEventManager(eventManager)
|
globalscope.setEventManager(eventManager)
|
||||||
logger.info("[AhenkDeamon] Event Manager was set")
|
logger.info("[AhenkDeamon] Event Manager was set")
|
||||||
|
|
||||||
|
db_service=AhenkDbService()
|
||||||
|
db_service.connect()
|
||||||
|
db_service.initialize_table()
|
||||||
|
globalscope.setDbService(db_service)
|
||||||
|
logger.info("[AhenkDeamon] Data Base Service was set")
|
||||||
|
|
||||||
messageManager = Messaging()
|
messageManager = Messaging()
|
||||||
globalscope.setMessageManager(messageManager)
|
globalscope.setMessageManager(messageManager)
|
||||||
logger.info("[AhenkDeamon] Message Manager was set")
|
logger.info("[AhenkDeamon] Message Manager was set")
|
||||||
|
@ -72,34 +77,42 @@ class AhenkDeamon(BaseDaemon):
|
||||||
logger.info("[AhenkDeamon] Execution Manager was set")
|
logger.info("[AhenkDeamon] Execution Manager was set")
|
||||||
|
|
||||||
|
|
||||||
|
#TODO restrict number of attemption
|
||||||
while registration.is_registered() is False:
|
while registration.is_registered() is False:
|
||||||
logger.debug("[AhenkDeamon] Attempting to register")
|
logger.debug("[AhenkDeamon] Attempting to register")
|
||||||
registration.registration_request()
|
registration.registration_request()
|
||||||
|
|
||||||
logger.info("[AhenkDeamon] Ahenk is registered")
|
logger.info("[AhenkDeamon] Ahenk is registered")
|
||||||
|
|
||||||
message_receiver = MessageReceiver()
|
messager = Messager()
|
||||||
rec_process = Process(target=message_receiver.connect_to_server)
|
messanger_thread = threading.Thread(target=messager.connect_to_server)
|
||||||
rec_process.start()
|
messanger_thread.start()
|
||||||
logger.info("[AhenkDeamon] Receiver was set")
|
|
||||||
|
while(messager.is_connected() is False):
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
globalscope.setMessager(messager)
|
||||||
|
logger.info("[AhenkDeamon] Messager was set")
|
||||||
|
|
||||||
if registration.is_ldap_registered() is False:
|
if registration.is_ldap_registered() is False:
|
||||||
logger.debug("[AhenkDeamon] Attempting to registering ldap")
|
logger.debug("[AhenkDeamon] Attempting to registering ldap")
|
||||||
registration.ldap_registration_request() #TODO bu mesaj daha kısa olabilir
|
registration.ldap_registration_request() #TODO work on message
|
||||||
|
|
||||||
logger.info("[AhenkDeamon] LDAP registration of Ahenk is completed")
|
logger.info("[AhenkDeamon] LDAP registration of Ahenk is completed")
|
||||||
|
|
||||||
#login
|
|
||||||
logger.info("[AhenkDeamon] Logining...")
|
|
||||||
message_sender=MessageSender(messageManager.login_msg(),None)
|
|
||||||
message_sender.connect_to_server()
|
|
||||||
|
|
||||||
|
#login
|
||||||
|
logger.info("[AhenkDeamon] Logining...")
|
||||||
|
messager.send_direct_message(messageManager.login_msg())
|
||||||
|
|
||||||
|
#request policies
|
||||||
|
logger.info("[AhenkDeamon] Requesting policies...")
|
||||||
|
messager.send_direct_message(messageManager.policy_request_msg())
|
||||||
|
|
||||||
#logout
|
#logout
|
||||||
#message_sender=MessageSender(messageManager.logout_msg(),None)
|
#logger.info("[AhenkDeamon] Logouting...")
|
||||||
#message_sender.connect_to_server()
|
#messager.send_direct_message(messageManager.logout_msg())
|
||||||
|
|
||||||
#rec_process.terminate()
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
this is must be created after message services
|
this is must be created after message services
|
||||||
|
|
Loading…
Reference in a new issue