mirror of
https://github.com/munki/munki.git
synced 2026-01-25 08:29:22 -06:00
************************************************************************************************************************************************************************************ https://github.com/munki/munki/pull/689#pullrequestreview-16492427 Commit based on comments by Greg Neagle on what to fix: munki#689 (master...ryanyu91:master) makecatalogs: removed debugging print statements manifestutil: check if repo is initialized before checking if it is mounted munkiimport: check if repo is initialized before checking if it is mounted for def add_icon_hash_to_pkginfo(pkginfo):, not opening file (icon_path) anymore WE_MOUNTED_THE_REPO is a repo attribute now, instead of a global variable FileRepo: removed duplicate/unused imports changed class to not be old-style updated glob method since pkgs was uninitialized made WE_MOUNTED_THE_REPO from global variable to FileRepo attribute variable initialized to False iconimporter: updated Repo call to include 3 parameters now.. changed old find_items_to_check calls to new call: findItemsToCheck Repo.py Added support for relative paths for importing plugins ************************************************************************************************************************************************************************************ Commit based on comments by Greg Neagle on what to fix: munki#685 (master...ryanyu91:master) IconImporter: Not opening DMG and then mounting it anymore, directly mounting like how it was before ManifestUtil: Checking if the repo is mounted as well as if we (munki) mounted it. Only this will display prompt whether we want to unmount or not FileRepo.py, Repo.py: not hardcoding import path anymore FileRepo - added 10.12 mounting fileshares code ************************************************************************************************************************************************************************************ Changed Files: code/client/munkiimport code/client/iconimporter code/client/makecatalogs code/client/manifestutil code/client/munkilib/iconutils.py Added Files: code/client/munkilib/FileRepo.py code/client/munkilib/Repo.py Reason For Changes: The purpose for this change is to enable plugins to munki that will allow writes to the munki repo to be customized. Changes: The methods used to write to the munki repo are the target of this modification. A plugin can create new methods for overwriting the default behavior of writing to the munki repo. The default behavior is retained in the absence of a plugin. This is accomplished via the introduction of FileRepo.py which continues to simply write changes to the munki repo. A plugin can be introduced to change this default behavior and allow munki repo writes to be redirected as desired by the plugin author. In order to accomplish this we have refactored all of the os.path.* methods, as well as the mount, unmount and available methods from the following tools: (iconimporter, makecatalogs, munkiimport, manifestutil, iconutils), and put them into a different python script to be used as a library or common code module. By default, these are now in the FileRepo.py module. The plugin can be used to overwrite this common code module. In addition to the above described changes, we also made the following changes to support this plugin concept: • Added the ability to add a plugin either via the command line or via munkiimport –configure • The code will look for custom plugins in the /usr/local/munki/munkilib/plugins/ directory • If plugin is found in the plugins directory, munkiimport --configure will give the option to type in the plugin name. For example, if you plugin is Foo.py, you could specify a plugin name of Foo in munkiimport --configure • If no plugin is found the FileRepo.py module will be used as the default common code module for writing to the munki repo • Add the ability to set the plugin via the --plugin option for the following tools (makecatalogs, munkiimport, manifestutil) Testing Tested with munkiimport on local filesystem/network shares/our own custom plugins Tested manifestutil on local filesystem/network Verified through regression testing, all features of munkiimport, makecatalogs, iconimporter, manifestutil from before all still work (local filesystem/network shares)