diff --git a/opt/ahenk/base/execution/ExecutionManager.py b/opt/ahenk/base/execution/ExecutionManager.py index 5d6ac79..d654bfc 100644 --- a/opt/ahenk/base/execution/ExecutionManager.py +++ b/opt/ahenk/base/execution/ExecutionManager.py @@ -8,6 +8,7 @@ import os import shutil import stat import subprocess +import ast from base.Scope import Scope from base.model.Policy import Policy @@ -66,6 +67,7 @@ class ExecutionManager(object): plugin_args = [str(plugin.get_active()), str(plugin.get_create_date()), str(plugin.get_deleted()), str(plugin.get_description()), str(plugin.get_machine_oriented()), str(plugin.get_modify_date()), str(plugin.get_name()), str(plugin.get_policy_plugin()), str(plugin.get_user_oriented()), str(plugin.get_version())] plugin_id = self.db_service.update('plugin', plugin_columns, plugin_args) + profile_args = [str(ahenk_policy_id), str(profile.get_create_date()), str(profile.get_modify_date()), str(profile.get_label()), str(profile.get_description()), str(profile.get_overridable()), str(profile.get_active()), str(profile.get_deleted()), str(profile.get_profile_data()), plugin_id] self.db_service.update('profile', profile_columns, profile_args) @@ -200,6 +202,7 @@ class ExecutionManager(object): username = json_data['username'] ahenk_prof_json_arr = json_data['agentPolicyProfiles'] user_prof_json_arr = json_data['userPolicyProfiles'] + ahenk_prof_arr = [] user_prof_arr = [] if ahenk_prof_json_arr is not None: diff --git a/opt/ahenk/base/plugin/Plugin.py b/opt/ahenk/base/plugin/Plugin.py index 2ecaa9d..48f21a7 100644 --- a/opt/ahenk/base/plugin/Plugin.py +++ b/opt/ahenk/base/plugin/Plugin.py @@ -72,7 +72,7 @@ class Plugin(threading.Thread): policy_module = Scope.getInstance().getPluginManager().findPolicyModule(item_obj.get_plugin().get_name()) self.context.put('username', item_obj.get_username()) policy_module.handle_policy(profile_data, self.context) - #TODO Message Code keep + #TODO Message Code keep Set default message if not exist response = Response(type=self.context.get('message_type'), id=item_obj.id, code=self.context.get('message_code'), message=self.context.get('message'), data=self.context.get('data'), content_type=self.context.get('content_type'), execution_id='get_execution_id') #self.response_queue.put(self.messaging.response_msg(response)) #TODO DEBUG Scope.getInstance().getMessager().send_direct_message(self.messaging.response_msg(response))#TODO REMOVE @@ -80,7 +80,6 @@ class Plugin(threading.Thread): # Empty context for next use self.context.empty_data() - elif obj_name == "KILL_SIGNAL": self.keep_run = False self.logger.debug('[Plugin] Killing queue ! Plugin Name : ' + str(self.name)) diff --git a/opt/ahenk/base/plugin/PluginManager.py b/opt/ahenk/base/plugin/PluginManager.py index df86170..91d16ba 100644 --- a/opt/ahenk/base/plugin/PluginManager.py +++ b/opt/ahenk/base/plugin/PluginManager.py @@ -101,6 +101,7 @@ class PluginManager(object): if ahenk_profiles is not None: for profile in ahenk_profiles: + profile.set_username(None) self.process_profile(profile) if user_profiles is not None: diff --git a/opt/ahenk/base/plugin/plugin_manager.py b/opt/ahenk/base/plugin/plugin_manager.py index 194860c..02a7181 100644 --- a/opt/ahenk/base/plugin/plugin_manager.py +++ b/opt/ahenk/base/plugin/plugin_manager.py @@ -100,6 +100,7 @@ class PluginManager(object): if ahenk_profiles is not None: for profile in ahenk_profiles: + profile.set_username(None) self.process_profile(profile) if user_profiles is not None: @@ -110,7 +111,7 @@ class PluginManager(object): def process_profile(self, profile): try: plugin = profile.get_plugin() - plugin_name = plugin.name + plugin_name = plugin.get_name() if plugin_name in self.pluginQueueDict: self.pluginQueueDict[plugin_name].put(profile, 1) except Exception as e: