Skip to content

Commit

Permalink
Merge pull request #12 from cscaglioned42/master
Browse files Browse the repository at this point in the history
D42-30527 - GitHub Jamf - Not all device fields being sent are getting saved in D42
Fixed issue where D42 would not be able to add/update a device if a None value was sent.
  • Loading branch information
cscaglioned42 committed Aug 16, 2023
2 parents 434a0a5 + 388d6ad commit c0da80b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions starter.py
Expand Up @@ -54,17 +54,23 @@ def get_computers(self):
'hddcount': hdd_count,
'hddsize': hdd_size,
'uuid': general['udid'] if general['udid'] else None,
'serial_no': general['serial_number'] if general['serial_number'] else None,
'hardware': hardware['model'] if hardware['model'] else None,
'os': hardware['os_name'] if hardware['os_name'] else None,
'osver': hardware['os_version'] if hardware['os_version'] else None,
'memory': hardware['total_ram_mb'] if hardware['total_ram_mb'] else None,
'cpucount': hardware['number_processors'] if hardware['number_processors'] else None,
'cpupower': hardware['processor_speed_mhz'] if hardware['processor_speed_mhz'] else None,
'cpucore': hardware['number_cores'] if hardware['number_cores'] else None,
'tags': general['asset_tag'] if general['asset_tag'] else None
})

if general['serial_number']:
device['serial_no'] = general['serial_number']

if hardware['processor_speed_mhz']:
device['cpupower'] = hardware['processor_speed_mhz']

if hardware['number_cores']:
device['cpucore'] = hardware['number_cores']

devices.append({
'device': {k: v for (k, v) in device.items() if str(v) != str(-1)},
'general': general,
Expand Down

0 comments on commit c0da80b

Please sign in to comment.