anilkumar61 / munki

Automatically exported from code.google.com/p/munki
Other
0 stars 0 forks source link

Munki 2 - Display custom error for failed preflight script. #310

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In the case of a preflight script failing for one of a number of reasons, it 
would be nice to be able to customise the text of the alert via the preflight 
script. This way the user could have a more meaningful warning displayed e.g. 
"Managed Software Center cannot check for updates while connected via VPN" 
rather than the generic warning to try again later.

the easiest way I can see this being a thing is if an admin could set a custom 
pref on error containing the warning text.

e.g. in a script I include

if [ $someCondition ]; then
    defaults write  /Library/Preferences/ManagedInstalls.plist preflightWarningText "danger will robinson"
    exit 1
fi

see 
https://code.google.com/r/bartreardon-munki/source/detail?name=Munki2&r=06c37377
6718c9ebef25a0e9592e403768238c4e

managing preflightWarningText would be up to the admin to re-set or it could be 
cleared after display by MSC.

Original issue reported on code.google.com by bart.rea...@gmail.com on 4 Apr 2014 at 12:54

GoogleCodeExporter commented 9 years ago
"it could be cleared after display by MSC."

Actually, it can't -- managedsoftwareupdate runs as root; MSC.app runs as the 
user. MSC.app can read values from /Library/Preferences/ManagedInstalls.plst, 
but can't modify them.

Still, something along these lines is worth considering in the future.

Original comment by gregnea...@mac.com on 4 Apr 2014 at 1:36

GoogleCodeExporter commented 9 years ago
The original idea was to capture stdout from the preflight script somehow but 
doing that looked messy.

perhaps it doesn't need to be cleared. if preflight exits > 0 that value is 
going to be overwritten anyway and it's there in the meantime as a record.

Original comment by bart.rea...@gmail.com on 4 Apr 2014 at 10:00