Skip to content

Commit

Permalink
Deal with offline checkins better (#46)
Browse files Browse the repository at this point in the history
Deal with offline checkins better
  • Loading branch information
grahamgilbert authored Jun 10, 2019
2 parents f0fe26d + f0babe6 commit f53c706
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion payload/usr/local/munki/postflight.d/sal-postflight
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ def check_server_connection():
return True

def check_server_online():
# is the offline report pref true?
if not utils.pref('SendOfflineReport'):
return
# read report
report = utils.get_managed_install_report()
# check for errors and warnings
if not check_for_errors(report):
utils.set_pref('LastRunWasOffline', False)
return
# if they're there check is server is really offline
if not check_server_connection():
if check_server_connection():
utils.set_pref('LastRunWasOffline', True)
return

Expand Down
2 changes: 1 addition & 1 deletion payload/usr/local/sal/bin/sal-submit
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import yaml


BUNDLE_ID = 'com.github.salopensource.sal'
VERSION = '2.1.4'
VERSION = '2.1.5'

# To resolve unicode write errors set our default encoding to utf8
reload(sys)
Expand Down
2 changes: 2 additions & 0 deletions payload/usr/local/sal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def pref(pref_name):
'GetGrains': False,
'GetOhai': False,
'LastRunWasOffline': False,
'SendOfflineReport': False,
}

pref_value = CFPreferencesCopyAppValue(pref_name, BUNDLE_ID)
Expand Down Expand Up @@ -138,6 +139,7 @@ def pythonScriptRunning(scriptname):
time.sleep(1)
counter = counter + 1


def check_script_running(scriptname):
"""
Returns Process ID for a running python script.
Expand Down

0 comments on commit f53c706

Please sign in to comment.