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

Module for admin-provided munki conditions #850

Merged
merged 13 commits into from
Nov 22, 2017

Conversation

nathanperkins
Copy link
Contributor

@nathanperkins nathanperkins commented Aug 3, 2017

resolve #627 from @flammable.
resolve #835 from @flammable.

Please let me know if you have any suggestions.

For one, I didn't know how to get the location of ManagedInstallReport.plist from prefs so it is hardcoded in the client script.

Second, all values are truncated and stored as 255 character strings. Would it be preferred to utilize BLOB so that JSON could be used to store arrays?

Munki Conditions Module

Provides the results of munki conditions, allowing admins to easily generate their own reportable datapoints without creating custom MunkiReport modules. Condition scripts are even easier to create using munki-facts.

Admin-Provided Condition scripts are found in /usr/local/munki/conditions.
The results of these scripts are stored in the 'Conditions' dictionary in /Library/Managed Installs/ManagedInstallReport.plist.

Both keys and values are truncated to 255 characters.

The following information is stored in the munki_conditions table:

  • serial_number
  • condition_key
  • condition_value

This module is mostly based on work by clburlison, erikng, bochoven and more.

screen shot 2017-08-03 at 12 12 40 am
screen shot 2017-08-03 at 12 12 55 am

@rickheil
Copy link
Contributor

rickheil commented Aug 3, 2017

The munkireport module grabs the Munki installation dir this way:

managed_install_dir = CoreFoundation.CFPreferencesCopyAppValue( "ManagedInstallDir", "ManagedInstalls")

You'll need to import CoreFoundation for this. I would set it to the default path like you are now, and only update if the ManagedInstallDir pref is set.

get path from prefs, shift code around
@nathanperkins
Copy link
Contributor Author

Thanks, I made some adjustments to the script to use the munki prefs, with a fallback to a default path if the pref doesn't work.

@nathanperkins
Copy link
Contributor Author

nathanperkins commented Aug 3, 2017

@tuxudo suggests that it would be best to have values stored as BLOB instead of VARCHAR. I will work on that next.

@bochoven
Copy link
Contributor

bochoven commented Oct 2, 2017

Sorry for the late reaction. This looks great. Just one nitpick: could you rename the module to munki_facts? Although they are used as conditions, I think they should be treated as facts.

@bochoven bochoven merged commit 59807d0 into munkireport:wip Nov 22, 2017
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

Successfully merging this pull request may close these issues.

3 participants