timer bug fixing and other minor fixing like log, redundant parameters ...

This commit is contained in:
Volkan Şahin 2016-07-25 12:21:23 +03:00
parent 70495628c7
commit dbfe504292
4 changed files with 5 additions and 10 deletions

View file

@ -332,6 +332,7 @@ class AhenkDeamon(BaseDaemon):
kward = {}
kward['timeout_args'] = username
kward['checker_args'] = username
SetupTimer.start(Timer(timeout=System.Ahenk.get_policy_timeout(), timeout_function=execute_manager.execute_default_policy, checker_func=execute_manager.is_policy_executed, kwargs=kward))
self.logger.info('[AhenkDeamon] Requesting updated policies from Lider. If Ahenk could not reach updated policies in {0} sec, booked policies will be executed'.format(System.Ahenk.get_policy_timeout()))

View file

@ -117,10 +117,8 @@ class ExecutionManager(object):
self.policy_executed[username] = False
def execute_default_policy(self, username):
print('username' + username)
self.logger.debug('[ExecutionManager] Executing active policies for {} user...'.format(username))
p=self.get_active_policies(username)
self.task_manager.addPolicy(p)
self.task_manager.addPolicy(self.get_active_policies(username))
def execute_policy(self, arg):
self.logger.debug('[ExecutionManager] Updating policies...')

View file

@ -171,7 +171,7 @@ class Plugin(threading.Thread):
self.context.empty_data()
except Exception as e:
self.logger.error("[Plugin] Plugin running exception about {0}. Exception Message: {1} ".format(obj_name, str(e)))
self.logger.error("[Plugin] Plugin running exception. Exception Message: {0} ".format(str(e)))
def get_execution_id(self, profile_id):
try:

View file

@ -4,7 +4,7 @@
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
import imp
import os
import threading
from base.Scope import Scope
from base.model.PluginBean import PluginBean
from base.model.modes.init_mode import InitMode
@ -201,10 +201,6 @@ class PluginManager(object):
def process_profile(self, profile):
##
scope = Scope().getInstance()
self.messenger = scope.getMessenger()
##
try:
plugin = profile.get_plugin()
plugin_name = plugin.get_name()
@ -215,7 +211,7 @@ class PluginManager(object):
self.logger.warning('[PluginManager] {} plugin not found. Profile was delayed. Ahenk will request plugin from Lider if distribution available'.format(plugin_name))
self.delayed_profiles[plugin_name] = profile
msg = self.message_manager.missing_plugin_message(PluginBean(name=plugin_name, version=plugin_ver))
self.messenger.send_direct_message(msg)
self.scope.getMessenger().send_direct_message(msg)
except Exception as e:
self.logger.error('[PluginManager] Exception occurred while processing profile. Error Message: {}'.format(str(e)))