Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not support 3 values in settings.conf (+ little other issue) #108

Open
ludolhoir opened this issue Apr 5, 2023 · 8 comments
Open

Comments

@ludolhoir
Copy link

Hello, hope you are well, still working on test environment, and things are going pretty well, except there is little issue when we try to add in the settings.conf more than two values in a raw,

example :

_snipeit_HDD_4 = hardware storage

works fine (only two values)

_snipeit_HDD_4 = hardware storage drive_capacity_mb
(or any as soon as we have three values)

and we have this error below. I tried with lot of subsets and everytime fails

File "/Users/ludoviclhoir/Desktop/jamf2snipe-main/jamf2snipe", line 901, in
jamf_value = jamf_value[item]
TypeError: list indices must be integers or slices, not str

another (very little one) is if we use the general mdm_capable_users result is {"mdm_capable_user":"username"} and should only be username, but it is not critical

thanks again alot for your precious help

@ludolhoir
Copy link
Author

we did a test on our real/prod hosted one and everything runs smoothly except these little points, anyway nice

@ludolhoir
Copy link
Author

just one thing with _snipeit_HDD_4 = hardware storage only we get all available values lie that

[{"disk":"disk0","model":"APPLE SSD AP0256N","revision":"1161.100","serial_number":"FV901430BHZLGY7C5","size":251000,"drive_capacity_mb":251000,"connection_type":"NO","smart_status":"Verified","partitions": etc etc , won't put it all here

@ParadoxGuitarist
Copy link
Collaborator

Just to throw out there:

another (very little one) is if we use the general mdm_capable_users result is {"mdm_capable_user":"username"} and should only be username, but it is not critical

This is actually a list of users. I get that you probably only have one person in the list (and most admins probably only have one user per device) , but Jamf doesn't care so it's putting in the whole "array". If you just need the user that's logged in, you could write an extension script to get the currently logged in user and write that to the JamfPro API then sync that data over.

I'm not sure there's a way to pick the "right user" out of the list and just sync that data since everyone else might use it differently.

@ludolhoir
Copy link
Author

@ParadoxGuitarist thanks, if i may i have little other question, do you know if there is a way to get the personal recovery key, we faced an issue on jamf and lost a device (sill under investigation) and so lost his personal recovery key, and we would like to backup the keys somewhere, and i thought that with jamf2snipe which is great tool/script i could do it, but could not find anywhere how to, in api or whatever, it might not be possible, but asking in case you might help on this, if not we add it manually

@ParadoxGuitarist
Copy link
Collaborator

If the keys are enrolled in Jamf, they should be there, but they're not part of the regular API info. Essentially Jamf treats them like a password (because they are) so you'd have to make a special call, that gets logged and that your API user has to have a special permission for, to be able to do that. It's actually been a long time since I've used Snipe-IT but I don't know if they have a similar way to obfuscate custom fields for sensitive information (like Keys). That doesn't mean you can't do it, but you might potentially be making some security concessions depending on your setup @ludolhoir

@ghosden
Copy link

ghosden commented May 14, 2024

I'm facing the same issue when I try to pull the drive size using (_snipeit_drive_capacity_16 = hardware storage).

Ex:

[{"disk":"disk0","model":"APPLE SSD SM0512G","revision":"BXZ83A0Q","serial_number":"[Removed]","size":500277,"drive_capacity_mb":500277,"connection_type":"NO","smart_status":"Verified","partitions":[{"name":"Update","size":500067,"type":"other","partition_capacity_mb":500067,"percentage_full":1,"available_mb":350746,"filevault_status":"Not Encrypted","filevault_percent":0,"filevault2_status":"Not Encrypted","filevault2_percent":0},{"name":"Macintosh HD (Boot Partition)","size":500067,"type":"boot","partition_capacity_mb":500067,"percentage_full":5,"available_mb":350746,"filevault_status":"Not Encrypted","filevault_percent":0,"filevault2_status":"Not Encrypted","filevault2_percent":0,"boot_drive_available_mb":350746,"lvgUUID":null,"lvUUID":null,"pvUUID":null},{"name":"Preboot","size":500067,"type":"other","partition_capacity_mb":500067,"percentage_full":1,"available_mb":350746,"filevault_status":"Not Encrypted","filevault_percent":0,"filevault2_status":"Not Encrypted","filevault2_percent":0},{"name":"Data","size":500067,"type":"other","partition_capacity_mb":500067,"percentage_full":28,"available_mb":350746,"filevault_status":"Not Encrypted","filevault_percent":0,"filevault2_status":"Not Encrypted","filevault2_percent":0}]}]

How can I pull the subset "drive_capacity_mb" of the main drive ?

@ParadoxGuitarist
Copy link
Collaborator

@ghosden

The easiest way is to write a Jamf Attribute Extension Script to store that information then you can call and sync it directly without needing to parse the rest of the information.

The harder way to do it, would be to re-write the logic for parsing the settings config so the python can get that info. It'll take a lot of work of trying to figure out how to systemicly get down to that level, unless you wanted to shorthand an new setting that had custom parser just for drive capacity.

@michael-zukrow-da
Copy link

michael-zukrow-da commented Jul 17, 2024

to confirm you are saying the documentation here is out of date? https://github.com/grokability/jamf2snipe/blob/main/settings.conf.example ?

GitHub
Import and sync assets from a JAMFPro instance to Snipe-IT asset management. - grokability/jamf2snipe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants