mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 11:12:15 +03:00
some fixing about logs
This commit is contained in:
parent
a5c864d33f
commit
23335f5d99
2 changed files with 14 additions and 7 deletions
|
@ -262,10 +262,12 @@ class AhenkDeamon(BaseDaemon):
|
|||
db_service = scope.getDbService()
|
||||
execute_manager = scope.getExecutionManager()
|
||||
|
||||
event=''
|
||||
try:
|
||||
json_data = json.loads(Commander().get_event())
|
||||
event=Commander().get_event()
|
||||
json_data = json.loads(event)
|
||||
except Exception as e:
|
||||
self.logger.error('[AhenkDeamon] A problem occurred while loading json. Check json format! Error Message: {0}'.format(str(e)))
|
||||
self.logger.error('[AhenkDeamon] A problem occurred while loading json. Check json format! Error Message: {0}.Event={1} '.format(str(e),str(event)))
|
||||
return
|
||||
|
||||
if json_data is not None:
|
||||
|
|
|
@ -79,7 +79,8 @@ class Commander(object):
|
|||
response['contentType'] = self.get_relevant_type(str(params[5]))
|
||||
response['responseData'] = Util.read_file(str(params[5]), 'rb')
|
||||
else:
|
||||
print('Wrong or missing parameter. Usage: send -t <task_id> -m|-f <message_content>|<file_path>')
|
||||
print(
|
||||
'Wrong or missing parameter. Usage: send -t <task_id> -m|-f <message_content>|<file_path>')
|
||||
return None
|
||||
|
||||
if len(params) > 6:
|
||||
|
@ -90,7 +91,8 @@ class Commander(object):
|
|||
elif params[6] == '-s':
|
||||
response['responseCode'] = MessageCode.TASK_PROCESSED.value
|
||||
else:
|
||||
print('Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -t <task_id> -m|-f <message_content>|<file_path> -e|-s|-w')
|
||||
print(
|
||||
'Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -t <task_id> -m|-f <message_content>|<file_path> -e|-s|-w')
|
||||
return None
|
||||
|
||||
elif len(params) > 7 and params[2] == '-p':
|
||||
|
@ -109,7 +111,8 @@ class Commander(object):
|
|||
response['contentType'] = self.get_relevant_type(str(params[7]))
|
||||
response['responseData'] = Util.read_file(str(params[7]), 'rb')
|
||||
else:
|
||||
print('Wrong or missing parameter. Usage: send -p <policy_version> -c <command_execution_id> -m|-f <message_content>|<file_path>')
|
||||
print(
|
||||
'Wrong or missing parameter. Usage: send -p <policy_version> -c <command_execution_id> -m|-f <message_content>|<file_path>')
|
||||
return None
|
||||
|
||||
if len(params) > 8:
|
||||
|
@ -120,11 +123,13 @@ class Commander(object):
|
|||
elif params[8] == '-s':
|
||||
response['responseCode'] = MessageCode.POLICY_PROCESSED.value
|
||||
else:
|
||||
print('Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -p <policy_version> -c <command_execution_id> -m|-f <message_content>|<file_path> -e|-s|-w')
|
||||
print(
|
||||
'Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -p <policy_version> -c <command_execution_id> -m|-f <message_content>|<file_path> -e|-s|-w')
|
||||
return None
|
||||
|
||||
else:
|
||||
print('Wrong or missing parameter. Usage: send -p <policy_version> -c <command_execution_id> -m|-f <message_content>|<file_path> -e|-s|-w')
|
||||
print(
|
||||
'Wrong or missing parameter. Usage: send -p <policy_version> -c <command_execution_id> -m|-f <message_content>|<file_path> -e|-s|-w')
|
||||
return None
|
||||
|
||||
resp = str(response).replace("\"{", "{")
|
||||
|
|
Loading…
Reference in a new issue