Commit Graph

649 Commits

Author SHA1 Message Date
Justin McWilliams 53d16dd778 Fix but in getIdleSeconds() where ioreg output is split, but there are inconsistent number of whitespaces.
I ran into a machine where "parts" was:  ['|', '|', '"HIDIdleTime"', '=', '1458195167613966'], and since parts[3] is "=" getIdleSeconds() was crashing trying to convert it to int().

So return int(int(parts[3])/1000000000) should really be parts[4] on this machine, but this may be inconsistent on different machines?

# /usr/sbin/ioreg -c IOHIDSystem -d 4 | grep Idle
   | |     "HIDIdleTime" = 1458351496253133

So let's just use regex to parse the integer out of the line more safely.



git-svn-id: http://munki.googlecode.com/svn/trunk@1103 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-09 15:10:46 +00:00
Justin McWilliams c0a9403e63 Syntax fix for r1098.
git-svn-id: http://munki.googlecode.com/svn/trunk@1102 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-08 17:59:31 +00:00
Greg Neagle d4261af782 munkiimport will copy the old forced_install and forced_uninstall keys as well as the new unattended_* keys to improve backwards compatibility.
git-svn-id: http://munki.googlecode.com/svn/trunk@1101 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-08 17:12:38 +00:00
Greg Neagle c0c0e2604c updatecheck now recognizes "forced_install" as a synonym for "unattended_install" and "forced_uninstall" as a synonym for "unattended_uninstall".
git-svn-id: http://munki.googlecode.com/svn/trunk@1100 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-08 17:03:54 +00:00
Justin McWilliams e84453eb5f s/forced_(un)install/unattended_(un)install/g
s/only_forced/only_unattended/g

Change forced_* pkginfo key names to more accurately describe what's happening, since they're not "forced" in the true sense of the word.

Admins should include both forced_* and unattended_* keys in their pkginfos while migrating to client releases after this change, to ensure both old and new clients have desired pkg push agressiveness :(


git-svn-id: http://munki.googlecode.com/svn/trunk@1098 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-08 16:23:45 +00:00
Greg Neagle 1c9e5784c1 - forced_installs and forced_uninstalls now work with items that are part of a dependency relationship
- makecatalogs now has no OS X-specific dependencies

- munkiimport fixes for repos hosted via SMB/CIFS.

git-svn-id: http://munki.googlecode.com/svn/trunk@1097 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-06 21:54:29 +00:00
Justin McWilliams b20b212431 Fix utils.runExternalScript docstring to match change in r1092.
git-svn-id: http://munki.googlecode.com/svn/trunk@1093 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-04 21:39:42 +00:00
Justin McWilliams 3f3a3b4dfd utils.runExternalScript should return stderr, and preflight/postflight stderr should be displayed and logged if return != 0
git-svn-id: http://munki.googlecode.com/svn/trunk@1092 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-04 21:38:33 +00:00
Greg Neagle 86d1780667 Clean up catalog files that are no longer in use by the client.
git-svn-id: http://munki.googlecode.com/svn/trunk@1091 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-04-01 15:31:16 +00:00
John Randolph b04cce845d add missing exception FileCopyError
git-svn-id: http://munki.googlecode.com/svn/trunk@1085 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-23 15:28:43 +00:00
John Randolph b6cb650938 add
--applesuspkgsonly
--munkipkgsonly

options to managedsoftwareupdate to override which packages it looks at



git-svn-id: http://munki.googlecode.com/svn/trunk@1084 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-22 22:00:49 +00:00
Greg Neagle cc5102287e inserted missing imports of "errno" and "shutil" into updatecheck.py (related to support for file:// URLs).
git-svn-id: http://munki.googlecode.com/svn/trunk@1073 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-16 17:50:30 +00:00
John Randolph 53ea11380c merge latest updatecheck.py from
/branches/packageinfo-packageurl-and-file-scheme

here



git-svn-id: http://munki.googlecode.com/svn/trunk@1071 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-16 17:41:43 +00:00
Greg Neagle 8f8b087729 Fix unhandled exception caused by installWithInfo returning just the needToRestart instead of the expected tuple in some cases.
git-svn-id: http://munki.googlecode.com/svn/trunk@1068 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-14 18:35:36 +00:00
Greg Neagle e5057c8c39 Fix for embedded uninstall scripts
git-svn-id: http://munki.googlecode.com/svn/trunk@1061 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-08 23:14:28 +00:00
Greg Neagle b32f6852a3 Formatting/typo fixes
git-svn-id: http://munki.googlecode.com/svn/trunk@1060 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-08 22:17:41 +00:00
Greg Neagle 35282d5115 Fixes for new preinstall_script and postinstall_script functionality.
git-svn-id: http://munki.googlecode.com/svn/trunk@1059 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-08 22:10:08 +00:00
Greg Neagle e9a7080191 Prevent postinstall script from running if install fails.
git-svn-id: http://munki.googlecode.com/svn/trunk@1058 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-08 18:23:40 +00:00
Greg Neagle 7f4a8420fa Add support for preinstall_script and postinstall_script in pkginfo.
git-svn-id: http://munki.googlecode.com/svn/trunk@1057 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-08 18:15:02 +00:00
Justin McWilliams 3882257b46 Change ManagedInstallReport::InstallResults to be a list of dictionary install results instead of list of strings. InstallResults dictionaries now look like the following:
{
  'name': 'Foo Package Install Name Without Version',  # display_name or name
  'version': '1.0.0.0',  # version_to_install
  'applesus': False,  # or True for Apple SUS installs.
  'status': 0,  # retcode, so 0 for success otherwise 1, 2, -1, -5, etc
}

Install.log output stays roughly the same, only prepending "Apple SUS" to such install strings.


git-svn-id: http://munki.googlecode.com/svn/trunk@1056 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-07 19:57:50 +00:00
Greg Neagle 731181c8c8 Bumping version to 0.7.1 for now...
git-svn-id: http://munki.googlecode.com/svn/trunk@1052 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-02 19:38:11 +00:00
Greg Neagle e1b39d02fd Patch from Rob Middleton for updatecheck.curl():
- if an etag is present in a partial only resume the download if it matches
- if resume if not possible immediately retry a full download
- log if eTag is missing for downloads we expect to be resumable (ie: pkgs)
- log if range / resume fails.
- delete the partial download in a few other error cases
- actually log the curl exit code / error string on all download failures.
- don't crash munki if the curl error string is not in expected form

git-svn-id: http://munki.googlecode.com/svn/trunk@1051 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-02 19:19:51 +00:00
John Randolph 4e06a85d55 encode unicode strings as utf-8 before sending over the wire.
surprisingly (to me, at least), sending encoded utf-8 without
escaping is legal according to:
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
...and also works properly in testing.



git-svn-id: http://munki.googlecode.com/svn/trunk@1050 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-03-02 18:01:30 +00:00
Justin McWilliams 676ec5588c In updatecheck.curl(), move time.sleep(0.1) up an indentation block so the sleep happens regardless of the tempdownloadpath exists or not.
The curl binary won't write tempdownloadpath until the request body begins downloading, not immediately after headers are completely received. On extremely slow/poor connections the curl() function may eat 100% CPU if headers have finished downloading but body has not yet started (and doesn't start for many seconds/etc).


git-svn-id: http://munki.googlecode.com/svn/trunk@1047 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-25 17:21:37 +00:00
Greg Neagle 685314da25 Fix so PyObjC __NSDate and __CFDate objects are converted to strings (previously we only did __NSCFDate) . Need to revisit date handling to/from CFPreferences...
git-svn-id: http://munki.googlecode.com/svn/trunk@1046 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-25 00:18:56 +00:00
Greg Neagle 15a9e6039b When processing installs or removals, move check for available disk space into download_installeritem so we don't decide there isn't enough space when the item has already been downloaded.
git-svn-id: http://munki.googlecode.com/svn/trunk@1034 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-22 21:08:13 +00:00
Greg Neagle e3a7e280e2 Fix for funky lines returned by ps -eo in getPIDforProcessName()
git-svn-id: http://munki.googlecode.com/svn/trunk@1033 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-17 09:11:31 +00:00
Greg Neagle 1002eb7a26 munkiimport: Only offer to unmount the repo if we mounted it in the first place.
git-svn-id: http://munki.googlecode.com/svn/trunk@1028 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-11 18:28:05 +00:00
Greg Neagle 72c8b0ac50 Fixed typo in munkiimport.findMatchingPkginfo()
git-svn-id: http://munki.googlecode.com/svn/trunk@1027 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-10 21:37:30 +00:00
Greg Neagle 1cc5fdc052 Replace calls to munkicommon.validPlist() (which called /usr/bin/plutil) with try:except FoundationPlist.NSPropertyListSerializationException blocks.
Attempt to make munki play nicer with HTTP server that don't support byte range requests (and therefore cannot support resumed downloads)

git-svn-id: http://munki.googlecode.com/svn/trunk@1026 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-08 18:30:00 +00:00
Greg Neagle 45fa7f011f Fix for pythonScriptRunning() so it won't throw an exception on ps output that isn't in the expected format
git-svn-id: http://munki.googlecode.com/svn/trunk@1018 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-02 21:24:10 +00:00
Greg Neagle 6e188c8cc7 Tweaks to better parse out the Software Update title, version and description from a wider variety of valid dist files.
git-svn-id: http://munki.googlecode.com/svn/trunk@1017 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-02-01 06:03:49 +00:00
Greg Neagle 69705bb33e Change version number handling to eliminate padding/truncating version numbers to five positions (ala 1.0.0.0.0).
git-svn-id: http://munki.googlecode.com/svn/trunk@1016 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-31 21:38:47 +00:00
Greg Neagle 7390b94f46 Minor change to notifyUserOfUpdates() in managedsoftwareupdate.
git-svn-id: http://munki.googlecode.com/svn/trunk@1013 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-27 23:01:34 +00:00
Greg Neagle 4fc6720ea5 Fix so a manifest that is missing a catalog list does not cause a TypeError exception in updatecheck.getAutoRemovalItems()
git-svn-id: http://munki.googlecode.com/svn/trunk@1011 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-25 22:49:26 +00:00
Greg Neagle a853f78c9f Update copyright dates across the board.
git-svn-id: http://munki.googlecode.com/svn/trunk@1010 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-25 18:22:14 +00:00
Greg Neagle e6dd9044c5 Fix to munkicommon.getAvailableDiskSpace() so long int doesn't get written to ManagedInstallsReport.plist, which results in an invalid plist as far as MunkiReport is concerned.
git-svn-id: http://munki.googlecode.com/svn/trunk@1009 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-24 23:34:30 +00:00
Greg Neagle a5e3180f44 Changes to what gets recorded in ManagedInstallsReport.plist to work nicer with MunkiReport.
git-svn-id: http://munki.googlecode.com/svn/trunk@1008 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-24 23:15:14 +00:00
Greg Neagle d50ec66c31 Minor cleanups.
git-svn-id: http://munki.googlecode.com/svn/trunk@1004 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-18 23:27:48 +00:00
Greg Neagle 8b54baa1c0 munkicommon: change to Spotlight search so we can bail if the search takes too long.
appleupdates: replace os.path.relpath() with something that also works under Leopard.

git-svn-id: http://munki.googlecode.com/svn/trunk@1003 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-18 20:10:27 +00:00
Greg Neagle 7384ca44f5 Changes in getSoftwareUpdateInfo() and processSoftwareUpdateDownload() to properly parse Apple Software Updates under Leopard.
git-svn-id: http://munki.googlecode.com/svn/trunk@1002 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-17 21:31:35 +00:00
Greg Neagle 45dd5f4d75 Fixed undefined "item" that should have been "install_item"
git-svn-id: http://munki.googlecode.com/svn/trunk@999 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-15 01:03:32 +00:00
Greg Neagle c2534d5cc8 Replaced instance of "os.listdir" with "munkicommon.listdir" in appleupdates.processSoftwareUpdateDownload()
git-svn-id: http://munki.googlecode.com/svn/trunk@998 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-14 23:45:57 +00:00
Greg Neagle abe3d2a1de appleupdates.py now creates its own .dist files to manage installation of downloaded Apple Software Updates, replacing the earlier technique of just installing the individual packages in filename order.
In most invocations of subprocess.Popen, change the bufsize from 1 to -1, which changes from line-buffered to "big" buffers.

Other minor changes to align with the appleupdates,py changes and some pylint-recommended cleanup.

git-svn-id: http://munki.googlecode.com/svn/trunk@995 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-14 19:11:05 +00:00
Greg Neagle 739df8dcd8 Defensive coding around munkicommon.display_error and munkicommon.display_warning to avoid a KeyError if munkicommon.report is missing the Errors or Warnings keys.
Similar defensive coding in installer.py for the InstallResults and RemovalResults keys.

Safer report initialization in managedsoftwareupdate.



git-svn-id: http://munki.googlecode.com/svn/trunk@993 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2011-01-04 19:33:25 +00:00
Greg Neagle 769e8dab91 Reworked reports to show more relevant data on ManagedInstalls. install-only munki sessions also carry over data from the previous run so the report is more complete.
git-svn-id: http://munki.googlecode.com/svn/trunk@980 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2010-12-15 21:34:25 +00:00
Justin McWilliams f098fb9d1d Typo fix: s/Perfoming/Performing/ in preflight task MSU notification.
git-svn-id: http://munki.googlecode.com/svn/trunk@978 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2010-12-15 18:13:56 +00:00
Greg Neagle 23928a4e7e Add back munkicommon.MANAGED_INSTALLS_PLIST_PATH and munkicommon.SECURE_MANAGED_INSTALLS_PLIST_PATH for use by preflight and postflight scripts.
git-svn-id: http://munki.googlecode.com/svn/trunk@974 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2010-12-13 23:05:37 +00:00
Greg Neagle 681acae624 Add MCX support, based on code contribution from Dan Roque.
Other minor clean-ups.

git-svn-id: http://munki.googlecode.com/svn/trunk@973 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2010-12-13 20:11:22 +00:00
Rob Middleton f87284d4d4 Remove tmpdir at expected exits of managedsoftwareupdate. tmpdir is created by global line in munkicommon: "tmpdir = tempfile.mkdtemp()". More fiddly to make the change so tmpdir only created where there is demand for it.
git-svn-id: http://munki.googlecode.com/svn/trunk@972 a4e17f2e-e282-11dd-95e1-755cbddbdd66
2010-12-12 09:11:22 +00:00