-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fix various issues with large Snipe-IT (50k+ assets, 50k+ users) and JAMF installations (5k+ assets) #119
base: main
Are you sure you want to change the base?
Conversation
Fix issues with Snipe-IT installs that have more than 500 models Fix issues with Snipe-IT installs that have many users (20k+), fetching them all is costly. Fix various code cleanliness and logic errors that crashed the program due to the weirdness in return values in large (and old) JAMF installations
value = value[key] | ||
except (KeyError, IndexError): | ||
logging.info(f"{key} does not exist") | ||
logging.debug(f"Ansible value: {value}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ansible? assuming this line was copied from elsewhere? ;)
if jamf['general']['serial_number'] == 'Not Available': | ||
if not jamf['general']['serial_number']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc This evaluates a literal string for "Not Available" that sometimes occurs for devices that are in Jamf via MDM but haven't checked in yet. Jamf didn't leave the it as null, but returned a valid string instead. That might have changed, but this would probably cause a regression as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my current JAMF instance, a system that is missing info may return null or an empty string ('') which would fail this check - however that fact doesn't seem to be consistent, sometimes it is null, sometimes it is an empty string, hence why I made the modification. I have not ran across the "Not Available" string, this may be an artifact from the old API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could also be a school.apple.com thing. I'd recommend altering the line to check for both so if it's either that literal string or null we're covered.
Fix issues with Snipe-IT installs that have more than 500 models
Fix issues with Snipe-IT installs that have many users, fetching them all is costly, query individuals and use a local cache instead
Fix various code cleanliness and logic errors that crashed the program due to the weirdness in return values in large (and old) JAMF installations