Commit Graph

139 Commits

Author SHA1 Message Date
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: https://github.com/munki/munki/pull/689/commits/77b7c95206daa9b28424e7124e7c690b7059d525
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
Greg Neagle f7748dc1df When importing a new version of an existing pkg, prefer the display_name of the previous version to any detected from the item being imported. Closes #483. 2016-07-15 16:11:33 -07:00
Greg Neagle ed70d8b816 munkiimport: When encoding text to be printed, use UTF-8 explictly instead of the current stdout encoding, which could be ASCII. Matches earlier munkiimport behavior. 2016-06-02 13:55:57 -07:00
Greg Neagle 0fb08de3f2 Attempt to better handle unicode characters in default text (like from a previous pkginfo) 2016-04-15 14:07:10 -07:00
Greg Neagle 51f6c7a58f Change prompt text when configuring to explain what happens if the editor is set to an empty string. 2016-04-11 09:59:36 -07:00
Greg Neagle 1f82f66ac7 Don't forget the prompt when there's no default text! 2016-04-08 12:22:37 -07:00
Greg Neagle 1288f7a7f2 Safety check in raw_input_with_default 2016-04-08 12:17:33 -07:00
Greg Neagle c8fb394633 More economical determination if readline lib is compiled against libedit 2016-04-03 18:23:30 -07:00
Greg Neagle e3948104e8 Use editable default text for munkiimport prompts. pylint cleanups. 2016-04-03 09:45:25 -07:00
Greg Neagle 53d2b0b5be At long last, munkiimport prompts for values for unattended_install and unattended_uninstall. 2016-03-30 09:49:00 -07:00
Greg Neagle 12d4f0d27e Update copyright info on files; remove abandoned tools from code/tools 2016-03-15 09:32:28 -07:00
Greg Neagle 37276f5307 Better determination when munkiimport item is an apple_update_metadata item; fixes bug where 'munkiimport --apple-item' worked but 'munkiimport --apple_item' failed, despite makepkginfo --help indicating both syntaxes should work. 2015-12-02 10:54:43 -08: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 41de516720 PyLint cleanup 2015-10-23 10:10:26 -07:00
Greg Neagle cc794c9c39 Merge pull request #532 from munki/samuel-munkiimport
Don't offer to create icons for profiles or Apple metadata
2015-10-23 10:05:47 -07:00
Samuel Keeley e0f771ceda Don't offer to create icons for profiles or Apple metadata 2015-10-23 10:02:47 -07:00
Shea Craig ae9cd75dc9 Add mobileconfig to the usage of munkiimport. 2015-10-23 11:32:31 -04:00
Greg Neagle 853fcfdb23 PyLint cleanups on munkiimport 2015-08-12 14:21:14 -07:00
Greg Neagle 416edbc2dc Fix issue when matching receipts when an individual receipts's version number is different from the overall item version number 2015-08-12 13:00:24 -07:00
Greg Neagle ba387f2b7c Convert all command-line arguments to Unicode (assuming utf-8 encoding) to eliminate issues with item paths containing Unicode characters 2015-03-13 12:20:20 -07:00
Greg Neagle c88ce43b65 Don't warn about no receipts or installs array for pkginfo for profiles 2015-01-20 21:34:46 -08:00
Arjen van Bochoven c3577c210a Added support for icon_hash to munkiimport 2015-01-19 22:49:57 +01:00
Greg Neagle a4a0d9d544 Merge config-profile-support into master 2015-01-13 06:55: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