Commit Graph

162 Commits

Author SHA1 Message Date
Clayton Burlison
e73c9bc652 fix: Don't print blank lines during munkiimport (#755) 2017-04-25 20:36:14 -07: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
a64b1d7ab3 Add 'startosinstall' support to iconimporter, makepkginfo, and munkiimport 2017-04-01 12:33:35 -07:00
Greg Neagle
e697441de4 munkiimport: If plugin is not given at the CLI or available via preferences, set options.plugin to 'FileRepo' so it is properly forwarded to makecatalogs 2017-03-15 08:59:08 -07:00
Greg Neagle
aa437f7895 munkiimport: special case handling of FileRepo (and children) when 'importing' a pkg already in the repo's pkgs directory 2017-03-15 08:46:10 -07:00
Greg Neagle
70f2800170 munkiimport: Minor wording change when printing warnings/errors at the end of a makecatalogs run 2017-03-14 07:12:22 -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
553eb503e9 munkiimport: Add a TODO 2017-03-11 19:40:21 -08:00
Greg Neagle
a9f1bf672c For an API repo, munkiimport can now forward the repo.authtoken to makecatalogs 2017-03-11 18:59:22 -08: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
a5a9c9e73d Get rid of global variables; improve handling of options that could be defined in prefs or via cli options 2017-03-11 08:55:49 -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
f327063a07 Merge branch 'Munki3' into new_repo_abstraction 2017-03-10 09:02:53 -08:00
Greg Neagle
d13a6c9926 Update prompt text for --configure 2017-03-10 06:59:27 -08:00
Greg Neagle
112aa3caa2 munkiimport: Remove prompt for repo_path 2017-03-09 18:38:51 -08:00
Greg Neagle
c3402ffce2 Minor naming changes 2017-03-09 10:17:47 -08:00
Per Olofsson
c773ebe7ac Implement featured_installs array in manifests. 2017-03-09 13:25:48 +01:00
Greg Neagle
f9ac3c776b makecatalogs and munkiimport working with new-style FileRepo plugin 2017-03-08 21:53:46 -08:00
Greg Neagle
9f3434c388 munkiimport working with new-style repo plugins 2017-03-08 13:54:13 -08:00
Greg Neagle
f47cd6ac1a Fix several incorrect .encode() methods called on strings returned from subprocess .readline() -- replace with .decode() method 2017-03-05 07:49:41 -08:00
Greg Neagle
0829c2406c Fix several incorrect .encode() methods called on strings returned from subprocess .readline() -- replace with .decode() method 2017-03-05 07:49:02 -08:00
Greg Neagle
ba0cb7c836 Missed an instance variable rename 2017-03-04 20:00:20 -08:00
Greg Neagle
0fb1d3cefa Begin reorg of repo plugins code 2017-03-04 08:19:29 -08:00
Greg Neagle
d6efe8b75f munkiimport: Properly record plugin in REPO_PLUGIN global and pass it to makecatalogs if/when we call it 2017-03-03 21:49:33 -08:00
Greg Neagle
92f5c895ae munkiimport: Remove munkicommon import; replace with refactored modules 2017-03-02 10:33:08 -08:00
Greg Neagle
9a8e3a4797 munkiimport: Copy unused_software_removal_info from prior package 2017-03-01 16:33:43 -08:00
Greg Neagle
aee6d005fb munkiimport copies 'featured' from prior version and also offers to edit it 2017-03-01 15:55:10 -08:00
Greg Neagle
1f90b8d039 Merge https://github.com/ryanyu91/munki into cloudrepo 2017-02-14 09:34:15 -08:00
Ryan Yu
67523fb58f replace REPO_PATH with repo.path since repo object keeps track of the path. 2017-02-02 16:17:45 -08:00
Ryan Yu
913a5fe2b1 in copy_pkginfo_to_repo , joined with REPO_PATH so pkginfo gets written to the correct path. 2017-02-02 15:57:23 -08:00
Ryan Yu
37cdff7f68 NEW CHANGES
************************************************************************************************************************************************************************************
https://github.com/munki/munki/pull/689#pullrequestreview-17297080
Commit based on comments by Greg Neagle on what to fix: munki#689 (master...ryanyu91:master)

FileRepo:
Move FileRepo to munkilib/plugins/

Repo:
Change plugins location for FileRepo

munkiimport:
Change plugins location for FileRepo in configure.

************************************************************************************************************************************************************************************
https://github.com/munki/munki/pull/689#pullrequestreview-17297080
Commit based on comments by Greg Neagle on what to fix: munki#689 (master...ryanyu91:master)

FileRepo:
Changed FileRepo class definition to not be old-style class

iconutils:
Deleted pkg_path join since passing in file anyways

munkiimport:
for --configure option, changed for relative paths support from same directory

Repo:
Changed for relative paths support from same directory

************************************************************************************************************************************************************************************
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-24 14:48:17 -08:00
Ryan Yu
2441eef7ed Ammending last commit: 77b7c95206
NEW CHANGES
************************************************************************************************************************************************************************************
https://github.com/munki/munki/pull/689#pullrequestreview-17297080
Commit based on comments by Greg Neagle on what to fix: munki#689 (master...ryanyu91:master)

FileRepo:
Changed FileRepo class definition to not be old-style class

iconutils:
Deleted pkg_path join since passing in file anyways

munkiimport:
for --configure option, changed for relative paths support from same directory

Repo:
Changed for relative paths support from same directory

************************************************************************************************************************************************************************************
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-20 10:37:30 -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
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
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
3133677958 changed description for munkiimport plugin option prompt/help text 2016-12-20 14:24:59 -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
Ryan Yu
af966ad2de Changed NewLine Differences and added 2 new imports. Fixed import class to use full path 2016-12-12 15:32:11 -08:00
Ryan Yu
aa3f89c8e4 -Refactor Repo methods into FileRepo and Repo
-added plugin option and configure for custom imports
-Updated munkiimport to latest version
2016-12-12 13:59:06 -08:00
Greg Neagle
069810a1ad Fixes for NetFS share mounting under 10.8.x 2016-10-31 13:54:18 -07:00
Greg Neagle
0518e4048e Make sure there is a repo_url before attempting to mount a fileshare in munkiimport and manifestutil 2016-10-24 16:18:37 -07:00
Greg Neagle
834796e967 Attempt #2 to catch KeyError exception when attempting to import NetFS's NetFSMountURLSync function. 2016-10-17 09:57:35 -07:00
Greg Neagle
8fa668edb6 Catch KeyError exception when attempting to import NetFS's NetFSMountURLSync function. 2016-10-14 14:27:04 -07:00
Greg Neagle
4aab802442 PyLint cleanups for munkiimport 2016-10-12 15:19:32 -07:00
Greg Neagle
78d58b58a5 Restore default text input in munkiimport under 10.6 2016-10-12 15:00:01 -07:00
Greg Neagle
23672ca187 Fix for ImportError: No module named NetFS error with munkiimport under OS X < 10.8 2016-10-12 10:26:34 -07:00
Greg Neagle
b076916c0b Fix for mounting repos under /Volumes in Sierra. 2016-09-23 16:22:31 -07:00
Greg Neagle
874f89ea96 munkiimport now uses CFPreferences methods to read and write its preferences. 2016-07-15 16:34:36 -07:00