Commit Graph

1843 Commits

Author SHA1 Message Date
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 515c42dda8 Revert "NEW CHANGES"
This reverts commit 543613a43f.
2017-01-16 13:29:58 -08:00
Ryan Yu 543613a43f 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:11:22 -08:00
Greg Neagle 24805bd99b Remove 'shebang' line from all Python modules that are not intended to be executed as scripts. This also causes my stupid editor to stop marking these files as executable. 2017-01-11 16:03:33 -08:00
Greg Neagle 24c76fe35c Fix unintended mass replace causulty. 2017-01-11 09:39:39 -08:00
Greg Neagle 1272a34d42 More removepackages reorganization 2017-01-10 16:30:49 -08:00
Greg Neagle 40519d2d4a More executable bits 2017-01-10 16:18:56 -08:00
Greg Neagle 9d697838dc Refactor removepackages 2017-01-10 16:17:48 -08:00
Greg Neagle 51bfe4ad9d Replace munkicommon references with replacement modules 2017-01-10 12:02:46 -08:00
Greg Neagle ea47fc7bb6 Replace munkicommon references with replacement modules 2017-01-10 11:56:56 -08:00
Greg Neagle a5e1fa2ba4 Replace munkicommon references with replacement modules 2017-01-10 11:51:50 -08:00
Greg Neagle ca9a030c9f Replace munkicommon references with replacement modules 2017-01-10 11:41:00 -08:00
Greg Neagle 4e834ebfc3 Fix executable bit 2017-01-10 11:33:55 -08:00
Greg Neagle 025323ac0c Replace munkicommon references with replacement modules 2017-01-10 11:33:16 -08:00
Greg Neagle 8e1fe8e926 Split up large appleupdates.core module 2017-01-10 10:30:07 -08:00
Greg Neagle cc24527b64 Split up too-large munkilib/updatecheck/core module 2017-01-10 09:59:13 -08:00
Greg Neagle dc66070a1b Remove execuatable bit 2017-01-10 09:58:19 -08:00
Greg Neagle a399d47e83 Missed function name change 2017-01-10 09:06:10 -08:00
Greg Neagle 2e905b0dea Once again remove executable bits that are getting set 2017-01-10 09:03:30 -08:00
Greg Neagle e605490e95 Lots of PyLint clean ups 2017-01-10 08:59:41 -08:00
Greg Neagle 7303b1215a PyLint cleanups 2017-01-09 11:39:57 -08:00
Greg Neagle 70a8c92ada PyLint cleanups 2017-01-09 11:12:12 -08:00
Greg Neagle dfbe8bbcad Fix tests 2017-01-09 10:45:20 -08:00
Greg Neagle ed3251e28f PyLint cleanups 2017-01-09 10:45:07 -08:00
Greg Neagle 208d22f1b0 PyLint cleanups 2017-01-09 10:15:10 -08:00
Greg Neagle 8deb944a7c decrease repeated defintions of the same function 2017-01-09 10:14:16 -08:00
Greg Neagle 0e56d0bae3 Change references to munkicommon to new modules; PyLint cleanup 2017-01-06 16:18:43 -08:00
Greg Neagle ba5cfd7be1 Stupid executable bits 2017-01-06 15:48:21 -08:00
Greg Neagle 09714a720b Change references to munkicommon to new modules; PyLint cleanup 2017-01-06 15:47:03 -08:00
Ryan Yu 430a7adc8d Support for relative paths in Repo 2017-01-06 15:40:15 -08:00
Greg Neagle a05bdd4d30 Change references to munkicommon to new modules; PyLint cleanup 2017-01-06 15:35:15 -08:00
Greg Neagle 0ac9463a6d Change references to munkicommon to new modules; PyLint cleanup 2017-01-06 15:32:47 -08:00
Greg Neagle 846c2cb3d1 Convert munkicommon references to their new modules 2017-01-06 15:20:49 -08:00
Greg Neagle dfc470b0f6 Remove executable bit 2017-01-06 15:20:08 -08:00
Greg Neagle 9021d40f72 Change relative import style 2017-01-06 15:10:36 -08:00
Greg Neagle 70aa3bd006 Restructure adobeutils 2017-01-06 14:45:13 -08:00
Greg Neagle 1a769c40f9 Better clean up of update cache 2017-01-06 14:44:29 -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
Greg Neagle b45c7132c1 Restructure installer.py and updatecheck.py 2017-01-06 13:24:25 -08:00
Greg Neagle ad1d523e24 Restructure appleupdates.py 2017-01-06 13:22:33 -08:00
Greg Neagle d0c06dabdc Minor tweaks 2017-01-04 09:38:27 -08:00
Greg Neagle 087bfa7d5f Rename munkilib/distutils.py to munkilib/appledistutils.py so as to not conflict with stdlib distutils 2017-01-04 09:37:45 -08:00
Greg Neagle 3acba9bcdc Move some functions from appleupdates.py to new distutils.py 2017-01-04 09:24:08 -08:00
Greg Neagle 39431b02e6 Move pkg install functions from installer.py to pkginstalls.py 2017-01-03 16:51:08 -08:00
Greg Neagle 5c4f883303 PyLint/formatting cleanups 2017-01-03 16:22:56 -08:00
Greg Neagle 0749cc6cde Get installinfo.py to 10/10 PyLint score 2017-01-03 16:21:48 -08:00
Greg Neagle f5f19137ab PyLint cleanups 2017-01-03 14:33:40 -08:00
Greg Neagle 6e3aecb4b6 Move copy-from-dmg functions into new copyfromdmg.py 2017-01-03 14:33:08 -08:00
Greg Neagle 6f5642af54 Tweak for parsing dist strings data using FoundationPlist 2017-01-03 10:31:22 -08:00
Greg Neagle 883dcef799 Memoize get_version since it won't change during a run 2017-01-03 08:20:12 -08:00