mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 16:42:20 +03:00
bug fixes and check plugin exists
This commit is contained in:
parent
cea2afccc6
commit
fedc9cbd2c
3 changed files with 18 additions and 6 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue