Promoting Items from Testing to Production in Munki Automatically

Promoting Items from Testing to Production in Munki Automatically

2014, Nov 12    

Over the past few weeks I have been working to develop a python script that will allow users to specify Applications that they would like to promote to the production catalog of their Munki repository based off the last modified time. This script at this point is a proof of concept and may not work in all environments. I am hoping to add additional features to the script such as promoting different applications to different catalogs based off last modified times. The project is currently in my GitHub repository and I'm definitely open to suggestions or ideas to make the script better. The Munki dev team however is currently looking for ways to incorporate this functionality into the core of Munki itself by adding special keys in the pkginfo files. If you'd like you can join in on that discussion here. If you'd like to mess around with the script that I created feel free to clone the repository located at https://github.com/joshua-d-miller/munki-promote. I look forward to any comments or ideas you may have. If you'd like past the break I can show you a basic setup.

To configure the script you would just make a munkipromote.conf from the munkipromotetemplate.conf file and then add in your preferences.  Listed below is a sample configuration of that file:

[munki]
MUNKI_REPO = /Volumes/munki/repo/pkgsinfo
MUNKI_APPS = ['Google Chrome', 'Mozilla Firefox', 'Dropbox', 'Box Sync']
MUNKI_TIME = 7
MUNKI_CATALOGS = ['production']

As you can see here we have configured these variables to be read in by the python file and then set the catalogs array to production for Google Chrome, Mozilla Firefox, Dropbox and Box Sync by scanning our repository. It is definitely good to note that the MUNKI_APPS variable is a list that when read will match the name in the list with the name in the pkginfo so please make sure that these match or it will fail. The MUNKI_TIME will be the amount of time the file has not been modified for. By default I like to use a week so that if the pkginfo has not been modified for a week then it will be moved to the production catalog. If I need to make a change to a pkginfo that has had an issue then the timer resets and it will not be changed. As always if there are questions about this script please let me know.