Added RAM info in notes

This commit is contained in:
Swapnil 2024-06-25 17:45:07 +05:30
parent c5474b1f3c
commit 61909258a0
Signed by untrusted user: swapnil
GPG Key ID: 58029C48BB100574

View File

@ -179,8 +179,18 @@ class ServerData:
processor_model = processor_info[0].get('Version', 'Unknown') if processor_info else 'Unknown'
processor_count = len(processor_info)
ram_info = [section for section in self.dmidecode_data if section['DMIType'] == 17]
ram_details = []
for ram in ram_info:
size = ram.get('Size', 'Unknown')
speed = ram.get('Speed', 'Unknown')
ecc = 'Yes' if ram.get('Total Width') == '72 bits' and ram.get('Data Width') == '64 bits' else 'No'
serial_number = ram.get('Serial Number', 'Unknown')
ram_type = ram.get('Type', 'Unknown')
ram_details.append("Size: {}, Speed: {}, ECC: {}, Serial Number: {}, Type: {}".format(size, speed, ecc, serial_number, ram_type))
note = "Chassis Model: {} | Serial Number: {} ||| Processor Model: {} | Count: {} ||| RAM Details: {}".format(
chassis_model, chassis_serial, processor_model, processor_count, '\n'.join(['R1', 'R2', 'R3']))
chassis_model, chassis_serial, processor_model, processor_count, ' | '.join(ram_details))
note_data = {
'note': note,