Commit Graph

63 Commits

Author SHA1 Message Date
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
31c9b661b8 remove uneeded osutils.cleanUpTmpDir() calls 2017-03-11 18:58:35 -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
51d8623391 Fix for version() subcommand function 2017-03-10 14:04:11 -08:00
Greg Neagle
46376a27c8 manifestutil: handle the following cases 1) no /path/to/repo; 2) no --repo-url 3) Existing repo_path preference 2017-03-10 13:43:10 -08:00
Greg Neagle
c1a345b1ad Another fix for 'empty' repo plugin for manifestutil 2017-03-10 12:13:29 -08:00
Greg Neagle
d181ab4e7d manifestutil: when connecting to a repo, if plugin is undefined, use FileRepo 2017-03-10 10:34:53 -08:00
Greg Neagle
237a1fa365 manifestutil --configure now prompts for plugin 2017-03-09 14:10:57 -08:00
Greg Neagle
b9fbbf118d --help option for subcommands no longer exits with an unhandled MyOptParseExit exception 2017-03-09 13:27:13 -08:00
Greg Neagle
9496f1a1ef manifestutil now works with new-style FileRepo plugin 2017-03-09 13:15:16 -08:00
Greg Neagle
a3c001e550 Update manifestutil to use the new munkirepo plugin structure 2017-03-04 08:29:44 -08:00
Greg Neagle
9878259dbc manifestutil: remove import of munkicommon; replace with new refactored modules 2017-03-02 10:13:35 -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
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
7c0a437f6c PyLint clean-ups 2016-10-24 08:26:30 -07:00
Greg Neagle
a8fb9feede Recursive indented printing of included manifests for manifestutil expand-included-manifests 2016-10-21 16:34:05 -07:00
Greg Neagle
7013581371 Really fix the fileshare mounting code in manifestutil 2016-10-21 15:58:25 -07:00
eholtam
69af0bae02 Added subcommand refresh-cache 2016-10-21 17:49:18 -05:00
Greg Neagle
4c8ed8f161 Merge branch 'master' of https://github.com/munki/munki 2016-10-21 15:39:18 -07:00
Greg Neagle
e9bdb65ade Add new Sierra-compatible fileshare mounting code to manifestutil. 2016-10-21 15:38:58 -07:00
Carl Windus
5d3521c3d7 Changed display-included-manifests to expand-included-manifests 2016-09-29 13:26:35 +10:00
Carl Windus
196eaaccf0 Added display_included_manifest() 2016-09-29 10:18:23 +10:00
eholtam
0fe3f8d0bf Added 'rename-manifest' subcommand to manifestutil 2016-08-12 22:14:22 -05:00
Greg Neagle
b5b9166125 manifestutil now uses CFPreferences methods to read/write configuration if they are available, falling back to plistlib if they are not. Closes #347. 2016-07-15 18:46:54 -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
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
19c88f76a3 Use sys.stdin.encoding and sys.stdout.encoding to convert to/from unicode 2016-04-03 09:40:16 -07:00
Greg Neagle
29c455ada6 Lots of pylint cleanup 2016-04-02 22:18:39 -07:00
Greg Neagle
e9f5d1955b For --configure, insert editable text with the current values for each prompt 2016-04-01 16:47:08 -07:00
Greg Neagle
424660b3c0 Don't print usage twice when <subcommand> --help is given non-interactively 2016-03-31 09:53:26 -07:00
Greg Neagle
9834f801e1 Using the --help option on subcommands no longer exits the pseudo shell 2016-03-31 09:39:30 -07:00
Greg Neagle
12d4f0d27e Update copyright info on files; remove abandoned tools from code/tools 2016-03-15 09:32:28 -07:00
eholtam
ad3be75da2 Cleaned up tabs on 888 and 889
Cleaned up tab
2016-01-07 10:47:30 -06:00
eholtam
4b261a6d47 Revert "Cleaned up tabbing"
This reverts commit fdc031ef83.
2016-01-07 10:46:12 -06:00
eholtam
fdc031ef83 Cleaned up tabbing
Cleaned up tabbing.
2016-01-07 10:45:34 -06:00
eholtam
36514fc748 Fixed manifestutil traceback if no subcommands are given
In manifestutil if no subcommands are given manifestutil exits with a
trackback.  I added a check to see if the number of subcommands is < 1
and to list the available subcommands if so.
2016-01-07 10:44:35 -06: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
eholtam
a663844ccf Update manifestutil find() output verbiage
Changed "items" to "matches" to better reflect what 'find' finds.
2015-09-01 11:01:31 -05:00
eholtam
5e9978f711 Remove find() breaks
Removing the breaks in the find function to allow multiple matches per section per manifest.
Addresses issue https://github.com/munki/munki/issues/512
2015-09-01 10:24:14 -05:00
Justin L R Graham
da85ea032b Sort catalog and manifest lists in manifestutil. 2014-10-16 13:06:25 -05:00
Greg Neagle
bb4fd416f8 manifestutil's interactive mode can now be cleanly exited via Control-D as suggested by Ryan Manly 2014-07-25 15:20:56 -07:00
Greg Neagle
e183d94ad7 Remove trailing whitespace from all lines in manifestutil (code style issue) 2014-07-22 10:16:26 -07:00
Greg Neagle
fddd138000 Bumping version to 1.0.0. Updated copyright dates. 2014-01-10 08:20:15 -08:00