diff --git a/opt/ahenk/base/database/AhenkDbService.py b/opt/ahenk/base/database/AhenkDbService.py index abd0cd2..9187b6d 100644 --- a/opt/ahenk/base/database/AhenkDbService.py +++ b/opt/ahenk/base/database/AhenkDbService.py @@ -111,6 +111,8 @@ class AhenkDbService(object): row = self.cursor.fetchone() if row is not None: return row[0] + else: + return None except Exception as e: raise else: diff --git a/opt/ahenk/base/execution/ExecutionManager.py b/opt/ahenk/base/execution/ExecutionManager.py index 2ccac74..59b089f 100644 --- a/opt/ahenk/base/execution/ExecutionManager.py +++ b/opt/ahenk/base/execution/ExecutionManager.py @@ -97,7 +97,7 @@ class ExecutionManager(object): default_file_path = self.config_manager.get('CONNECTION', 'receiveFileParam') j = json.loads(arg) # msg_id =str(j['id']).lower() - target_file_path = str(j['filepath']).lower() + target_file_path = str(j['filePath']).lower() file_name = str(j['filename']).lower() self.logger.debug('[ExecutionManager] ' + file_name + ' will be moved to ' + target_file_path) shutil.move(default_file_path + file_name, target_file_path + file_name) @@ -105,7 +105,7 @@ class ExecutionManager(object): def execute_script(self, arg): j = json.loads(arg) # msg_id =str(j['id']).lower() - file_path = str(j['filepath']).lower() + file_path = str(j['filePath']).lower() time_stamp = str(j['timestamp']).lower() self.logger.debug('[ExecutionManager] Making executable file (%s) for execution' % file_path) st = os.stat(file_path) @@ -116,7 +116,7 @@ class ExecutionManager(object): def request_file(self, arg): j = json.loads(arg) # msg_id =str(j['id']).lower() - file_path = str(j['filepath']).lower() + file_path = str(j['filePath']).lower() time_stamp = str(j['timestamp']).lower() self.logger.debug('[ExecutionManager] Requested file is ' + file_path) self.messager.send_file(file_path) diff --git a/opt/ahenk/base/plugin/PluginManager.py b/opt/ahenk/base/plugin/PluginManager.py index 6bdec16..3d6feed 100644 --- a/opt/ahenk/base/plugin/PluginManager.py +++ b/opt/ahenk/base/plugin/PluginManager.py @@ -17,10 +17,12 @@ class PluginManager(object): super(PluginManager, self).__init__() self.scope = Scope.getInstance() self.configManager = self.scope.getConfigurationManager() + self.db_service = self.scope.getDbService() self.plugins = [] self.pluginQueueDict = dict() self.logger = self.scope.getLogger() + #TODO version? def loadPlugins(self): self.plugins = [] possibleplugins = os.listdir(self.configManager.get("PLUGIN", "pluginFolderPath")) @@ -64,9 +66,17 @@ class PluginManager(object): # Not implemented yet pass - def checkPluginExists(self, pluginName): - # Not implemented yet - pass + def checkPluginExists(self, plugin_name, version=None): + + criteria = ' name=\''+plugin_name+'\'' + if version is not None: + criteria += ' and version=\'' + str(version) + '\'' + result = self.db_service.select('plugin', 'name', criteria) + + if result is None: + return False + else: + return True def reloadSinglePlugin(self, pluginName): # Not implemented yet