def checkForceInstallPackages():
    result = None

    ManagedInstallDir = munkicommon.pref('ManagedInstallDir')

    installinfo_types = {
        'InstallInfo.plist' : 'managed_installs',
        'AppleUpdates.plist': 'AppleUpdates'
    }

    now = NSDate.date()
    now_xhours = NSDate.dateWithTimeIntervalSinceNow_(
        FORCE_INSTALL_WARNING_HOURS * 3600)

    for installinfo_plist in installinfo_types.keys():
        pl_dict = installinfo_types[installinfo_plist]
        installinfopath = os.path.join(ManagedInstallDir, installinfo_plist)
        try:
            installinfo = FoundationPlist.readPlist(installinfopath)
        except FoundationPlist.NSPropertyListSerializationException:
            continue

        writeback = False

        for i in xrange(len(installinfo.get(pl_dict, []))):
            install = installinfo[pl_dict][i]
            force_install_after_date = install.get('force_install_after_date')

            if force_install_after_date:
                force_install_after_date = subtractTimeZoneOffsetFromDate(
                    force_install_after_date)
                munkicommon.display_debug1(
                    'Forced install for %s at %s',
                    install['name'], force_install_after_date)
                if now >= force_install_after_date:
                    result = 'now'
                    if install.get('RestartAction'):
                        if install['RestartAction'] == 'RequireLogout':
                            result = 'logout'
                        elif (install['RestartAction'] == 'RequireRestart' or
                              install['RestartAction'] == 'RecommendRestart'):
                            result = 'restart'
                    elif not install.get('unattended_install', False):
                        munkicommon.display_debug1(
                            'Setting unattended install for %s',
                            install['name'])
                        install['unattended_install'] = True
                        installinfo[pl_dict][i] = install
                        writeback = True

                if now_xhours >= force_install_after_date:
                    if not result:
                        result = 'soon'

        if writeback:
            FoundationPlist.writePlist(installinfo, installinfopath)

    return result
Check installable packages and applicable Apple updates
dataset/ETHPy150Open munki/munki/code/client/munkilib/updatecheck.py/checkForceInstallPackages