Skip to content

Instantly share code, notes, and snippets.

@timsutton
Created June 5, 2013 12:52
Show Gist options
  • Save timsutton/5713636 to your computer and use it in GitHub Desktop.
Save timsutton/5713636 to your computer and use it in GitHub Desktop.
Small fix to possibly handle broken system_profiler by dying immediately, instead of only timing out.
diff --git a/code/client/munkilib/munkicommon.py b/usr/local/munki/munkilib/munkicommon.py
index 428bc14..999947d 100755
--- a/code/client/munkilib/munkicommon.py
+++ b/usr/local/munki/munkilib/munkicommon.py
@@ -2032,7 +2032,11 @@ def getSPApplicationData():
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
- output, unused_error = proc.communicate(timeout=60)
+ output, err = proc.communicate(timeout=60)
+ if err:
+ display_error("error from system_profiler:")
+ display_error(err)
+ return SP_APPCACHE
except TimeoutError:
display_error(
'system_profiler hung; skipping SPApplicationsDataType query')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment