Commit Graph

38 Commits

Author SHA1 Message Date
Greg Neagle 72a0535d0d Update Copyright dates 2020-01-01 08:53:37 -08:00
Greg Neagle af51af5cdd Change all sh-bang lines to #!/usr/local/munki/python 2019-07-16 22:14:47 -07:00
Greg Neagle 19e2d59e08 iconimporter uses FoundationPlist once again 2019-06-17 16:06:17 -07:00
Greg Neagle 4b2327d54b More Python 3 compatibility 2019-06-04 22:27:29 -07:00
Greg Neagle f1df5d96a6 Pylint fixes 2019-05-05 12:48:15 -07:00
Greg Neagle df60207145 Add 'from __future__ import absolute_import' to all files to enforce Python3-style imports 2019-05-03 21:34:56 -07:00
Elliot Jordan 2ad27ff411 Align except clauses with PEP 3110 (#933)
This should work for Python 2.6+, including 3.
https://www.python.org/dev/peps/pep-3110/#compatibility-issues
2019-05-03 15:05:13 -07:00
Greg Neagle 918d0b7391 Update copyright dates 2019-01-02 10:31:50 -08:00
Greg Neagle 1428c40d06 Update copyright notices to include 2018 2018-01-20 08:46:22 -08:00
Clayton Burlison 5e754bc5e7 fix: Remove duplicate --plugin flag (#751)
This removes the duplicate --plugin flag from the help menu of:
* iconimporter
* makecatalogs
* munkiimport
* repoclean
2017-04-22 00:03:43 -05:00
Greg Neagle fe3d133d02 Code cleanup 2017-04-08 08:09:45 -07:00
Greg Neagle a64b1d7ab3 Add 'startosinstall' support to iconimporter, makepkginfo, and munkiimport 2017-04-01 12:33:35 -07:00
Greg Neagle e042a2c8d5 Move many functions shared by the various cli tools to munkilib/cliutils.py 2017-03-13 08:03:23 -07:00
Greg Neagle d1d3f5dcd2 Move code that uses FileRepo as a default if no repo is specified to munkilib/munkirepo/__init__.py 2017-03-11 09:06:09 -08:00
Greg Neagle 60bea033cf Extra caution to always default to FileRepo if plugin value is None or '' 2017-03-10 12:16:37 -08:00
Greg Neagle 3faffc46d3 Updated comments 2017-03-09 18:38:04 -08:00
Greg Neagle 1ddc07141f Make iconiporter work with new-style repo plugins 2017-03-09 10:17:17 -08:00
Greg Neagle 0fb1d3cefa Begin reorg of repo plugins code 2017-03-04 08:19:29 -08:00
Greg Neagle 3ca9d000a0 iconimporter: remove import of munkicommon; replace with the refactored modules 2017-03-02 08:36:17 -08:00
Greg Neagle 1f90b8d039 Merge https://github.com/ryanyu91/munki into cloudrepo 2017-02-14 09:34:15 -08:00
Greg Neagle 4053a0dbe7 Update copyright dates to 2017 2017-01-17 20:14:31 -08:00
Ryan Yu 0afd9e1913 NEW CHANGES
************************************************************************************************************************************************************************************
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)
2017-01-16 13:46:53 -08:00
Ryan Yu cfca75aca7 Pull request comments by Greg Neagle on what to fix: https://github.com/munki/munki/pull/685
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
2017-01-06 13:32:32 -08:00
Ryan Yu 0c475075e4 Refactored iconimporter, makecatalogs, manifestutil, iconutils Repo methods to Repo/FileRepo to support custom plugin functionality 2016-12-14 13:31:48 -08:00
Greg Neagle 8522d4793d iconimporter now uses CFPreferences methods to read configuration; PyLint cleanups 2016-07-15 16:52:37 -07:00
Greg Neagle 12d4f0d27e Update copyright info on files; remove abandoned tools from code/tools 2016-03-15 09:32:28 -07:00
Samuel Keeley 5c12185da4 Replace http://www.apache.org/licenses/LICENSE-2.0 with https://www.apache.org/licenses/LICENSE-2.0 2015-11-13 20:35:24 -08:00
Greg Neagle 58d8a07dec Clean up the tmpdir on exit of iconimporter, makepkginfo and munkiimport 2015-01-09 15:08:52 -08:00
Justin L R Graham 6f8aa360d8 More explicit help string for items argument to iconimporter.
As per discussion in pull request #413.
2014-10-23 15:41:48 -05:00
Justin L R Graham 5878275821 Added options to restrict run to specified repo items. 2014-10-23 14:21:39 -05:00
Greg Neagle 76fac17a40 Remove trailing whitespace from all lines in iconimporter (code style issue) 2014-07-22 10:26:29 -07:00
Greg Neagle 7553e942e7 Refactor iconimporter to use munkilib/iconutils.py; fix some broken error reporting in munkilib/iconutils.py 2014-06-19 21:33:31 -07:00
Greg Neagle 4f2dd83b35 Handle all paths and path fragments as Unicode 2014-03-26 14:31:35 -07:00
Greg Neagle 3c25bc2a65 Properly create missing icons directory in munki repo. 2014-03-25 13:56:51 -07:00
Greg Neagle ddf08cb0c0 Properly handle mpkgs that contain other mpkgs (!) 2014-03-25 08:39:41 -07:00
Greg Neagle 8090ce5817 Better icon extraction from flat packages that aren't distribution pkgs 2014-03-24 16:13:16 -07:00
Greg Neagle acdd39c035 Use FoundationPlist to read our local prefs 2014-03-24 15:12:35 -07:00
Greg Neagle c03cb77fff Added iconimporter tool 2014-03-24 15:01:31 -07:00