mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 22:52:24 +03:00
prepare json messages for fix events
This commit is contained in:
parent
3005bc4b3f
commit
e0f68c9bf2
1 changed files with 7 additions and 6 deletions
|
@ -10,15 +10,17 @@ from base.Scope import Scope
|
||||||
class Messaging(object):
|
class Messaging(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
print("messaging initilaziton")
|
|
||||||
scope = Scope().getInstance()
|
scope = Scope().getInstance()
|
||||||
self.logger = scope.getLogger()
|
self.logger = scope.getLogger()
|
||||||
self.configurationManager = scope.getConfigurationManager()
|
self.configurationManager = scope.getConfigurationManager()
|
||||||
self.event_manger=scope.getEventManager()
|
self.event_manger=scope.getEventManager()
|
||||||
|
|
||||||
|
#TODO can use sh commands for getting username and timestamp
|
||||||
|
|
||||||
def login_msg(self):
|
def login_msg(self):
|
||||||
data = {}
|
data = {}
|
||||||
data['type'] = 'login'
|
data['type'] = 'LOGIN'
|
||||||
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
||||||
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
|
@ -26,7 +28,7 @@ class Messaging(object):
|
||||||
|
|
||||||
def logout_msg(self):
|
def logout_msg(self):
|
||||||
data = {}
|
data = {}
|
||||||
data['type'] = 'logout'
|
data['type'] = 'LOGOUT'
|
||||||
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
||||||
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
|
@ -34,7 +36,7 @@ class Messaging(object):
|
||||||
|
|
||||||
def get_policies_msg(self):
|
def get_policies_msg(self):
|
||||||
data = {}
|
data = {}
|
||||||
data['type'] = 'get_policies'
|
data['type'] = 'GET_POLICIES'
|
||||||
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
||||||
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
|
@ -42,8 +44,7 @@ class Messaging(object):
|
||||||
|
|
||||||
def unregister_msg(self):
|
def unregister_msg(self):
|
||||||
data = {}
|
data = {}
|
||||||
data['type'] = 'registration'
|
data['type'] = 'UNREGISTER'
|
||||||
data['status'] = 'unregister'
|
|
||||||
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
data['username'] = str(pwd.getpwuid( os.getuid() )[ 0 ])
|
||||||
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
data['timestamp'] = str(datetime.datetime.now().strftime("%d-%m-%Y %I:%M"))
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
|
|
Loading…
Reference in a new issue