registration parameters were updated

This commit is contained in:
Volkan Şahin 2016-05-17 12:28:17 +03:00
parent 1979d4815e
commit bff63ae806

View file

@ -98,31 +98,32 @@ class Registration():
def get_registration_params(self): def get_registration_params(self):
print(System.Hardware.Network.ip_addresses())
params = { params = {
'ipAddresses': self.get_ip_address(), 'ipAddresses': str(System.Hardware.Network.ip_addresses()).replace('\'localhost\'', '').replace('\'127.0.0.1\'', ''),
'macAddresses': System.Hardware.mac_address(), 'macAddresses': System.Hardware.mac_address(),
'hostname': str(socket.gethostname()), 'hostname': System.Os.hostname(),
'system': str(platform.system()), 'os.name': System.Os.name(),
'node': str(platform.node()), 'os.version': System.Os.version(),
'release': str(platform.release()), 'os.kernel': System.Os.kernel_release(),
'version': str(platform.version()), 'os.distributionName': System.Os.distribution_name(),
'machine': str(platform.machine()), 'os.distributionId': System.Os.distribution_id(),
'processor': str(platform.processor()), 'os.distributionVersion': System.Os.distribution_version(),
'architecture': str(platform.architecture()), 'os.architecture': System.Os.architecture(),
'cpuCount': str(psutil.cpu_count()), 'hardware.cpu.architecture': System.Hardware.Cpu.architecture(),
'diskInfo': self.get_disks() 'hardware..cpu.logicalCoreCount': System.Hardware.Cpu.logical_core_count(),
'hardware..cpu.physicalCoreCount': System.Hardware.Cpu.physical_core_count(),
'hardware.disk.total': System.Hardware.Disk.total(),
'hardware.disk.used': System.Hardware.Disk.used(),
'hardware.disk.free': System.Hardware.Disk.free(),
'hardware.disk.partitions': System.Hardware.Disk.partitions(),
'hardware.memory.total': System.Hardware.Memory.total(),
'hardware.network.ipAddresses': System.Hardware.Network.ip_addresses(),
'sessions.userNames': System.Sessions.user_name(),
} }
return json.dumps(params) return json.dumps(params)
def get_ip_address(self): """
arr = []
for ip in System.Hardware.Network.ip_addresses():
if ip is not 'localhost' and ip is not '127.0.0.1':
arr.append(ip)
return str(arr).replace('[','').replace(']','')
def get_disks(self): def get_disks(self):
disk_info = [] disk_info = []
for _disk in psutil.disk_partitions(): for _disk in psutil.disk_partitions():
@ -134,6 +135,7 @@ class Registration():
json_data = json.dumps(disk) json_data = json.dumps(disk)
disk_info.append(json_data) disk_info.append(json_data)
return disk_info return disk_info
"""
def unregister(self): def unregister(self):
self.logger.debug('[Registration] Ahenk is unregistering...') self.logger.debug('[Registration] Ahenk is unregistering...')