コード例 #1
0
ファイル: reports.py プロジェクト: dodobyrd/munki
def format_time(timestamp=None):
    """Return timestamp as an ISO 8601 formatted string, in the current
    timezone.
    If timestamp isn't given the current time is used."""
    if timestamp is None:
        return str(NSDate.new())
    return str(NSDate.dateWithTimeIntervalSince1970_(timestamp))
コード例 #2
0
ファイル: reports.py プロジェクト: SteveKueng/munki
def format_time(timestamp=None):
    """Return timestamp as an ISO 8601 formatted string, in the current
    timezone.
    If timestamp isn't given the current time is used."""
    if timestamp is None:
        return str(NSDate.new())
    else:
        return str(NSDate.dateWithTimeIntervalSince1970_(timestamp))
コード例 #3
0
ファイル: prefs.py プロジェクト: poundbangbash/munki
def pref(pref_name):
    """Return a preference. Since this uses CFPreferencesCopyAppValue,
    Preferences can be defined several places. Precedence is:
        - MCX/configuration profile
        - /var/root/Library/Preferences/ByHost/ManagedInstalls.XXXXXX.plist
        - /var/root/Library/Preferences/ManagedInstalls.plist
        - /Library/Preferences/ManagedInstalls.plist
        - default_prefs defined here.
    """
    default_prefs = {
        'ManagedInstallDir': '/Library/Managed Installs',
        'SoftwareRepoURL': 'http://munki/repo',
        'ClientIdentifier': '',
        'LogFile': '/Library/Managed Installs/Logs/ManagedSoftwareUpdate.log',
        'LoggingLevel': 1,
        'LogToSyslog': False,
        'InstallAppleSoftwareUpdates': False,
        'AppleSoftwareUpdatesOnly': False,
        'SoftwareUpdateServerURL': '',
        'DaysBetweenNotifications': 1,
        'LastNotifiedDate': NSDate.dateWithTimeIntervalSince1970_(0),
        'UseClientCertificate': False,
        'SuppressUserNotification': False,
        'SuppressAutoInstall': False,
        'SuppressStopButtonOnInstall': False,
        'PackageVerificationMode': 'hash',
        'FollowHTTPRedirects': 'none',
        'UnattendedAppleUpdates': False,
        'PerformAuthRestarts': False,
    }
    pref_value = CFPreferencesCopyAppValue(pref_name, BUNDLE_ID)
    if pref_value is None:
        pref_value = default_prefs.get(pref_name)
        # we're using a default value. We'll write it out to
        # /Library/Preferences/<BUNDLE_ID>.plist for admin
        # discoverability
        set_pref(pref_name, pref_value)
    if isinstance(pref_value, NSDate):
        # convert NSDate/CFDates to strings
        pref_value = str(pref_value)
    return pref_value
コード例 #4
0
ファイル: prefs.py プロジェクト: clburlison/munki
def pref(pref_name):
    """Return a preference. Since this uses CFPreferencesCopyAppValue,
    Preferences can be defined several places. Precedence is:
        - MCX/configuration profile
        - /var/root/Library/Preferences/ByHost/ManagedInstalls.XXXXXX.plist
        - /var/root/Library/Preferences/ManagedInstalls.plist
        - /Library/Preferences/ManagedInstalls.plist
        - default_prefs defined here.
    """
    default_prefs = {
        'ManagedInstallDir': '/Library/Managed Installs',
        'SoftwareRepoURL': 'http://munki/repo',
        'ClientIdentifier': '',
        'LogFile': '/Library/Managed Installs/Logs/ManagedSoftwareUpdate.log',
        'LoggingLevel': 1,
        'LogToSyslog': False,
        'InstallAppleSoftwareUpdates': False,
        'AppleSoftwareUpdatesOnly': False,
        'SoftwareUpdateServerURL': '',
        'DaysBetweenNotifications': 1,
        'LastNotifiedDate': NSDate.dateWithTimeIntervalSince1970_(0),
        'UseClientCertificate': False,
        'SuppressUserNotification': False,
        'SuppressAutoInstall': False,
        'SuppressStopButtonOnInstall': False,
        'PackageVerificationMode': 'hash',
        'FollowHTTPRedirects': 'none',
        'UnattendedAppleUpdates': False,
        'PerformAuthRestarts': False,
    }
    pref_value = CFPreferencesCopyAppValue(pref_name, BUNDLE_ID)
    if pref_value is None:
        pref_value = default_prefs.get(pref_name)
        # we're using a default value. We'll write it out to
        # /Library/Preferences/<BUNDLE_ID>.plist for admin
        # discoverability
        set_pref(pref_name, pref_value)
    if isinstance(pref_value, NSDate):
        # convert NSDate/CFDates to strings
        pref_value = str(pref_value)
    return pref_value
コード例 #5
0
 'AdditionalHttpHeaders': None,
 'AppleSoftwareUpdatesOnly': False,
 'CatalogURL': None,
 'ClientCertificatePath': None,
 'ClientIdentifier': '',
 'ClientKeyPath': None,
 'ClientResourcesFilename': None,
 'ClientResourceURL': None,
 'DaysBetweenNotifications': 1,
 'FollowHTTPRedirects': 'none',
 'HelpURL': None,
 'IconURL': None,
 'IgnoreSystemProxies': False,
 'InstallRequiresLogout': False,
 'InstallAppleSoftwareUpdates': False,
 'LastNotifiedDate': NSDate.dateWithTimeIntervalSince1970_(0),
 'LocalOnlyManifest': None,
 'LogFile': '/Library/Managed Installs/Logs/ManagedSoftwareUpdate.log',
 'LoggingLevel': 1,
 'LogToSyslog': False,
 'ManagedInstallDir': '/Library/Managed Installs',
 'ManifestURL': None,
 'PackageURL': None,
 'PackageVerificationMode': 'hash',
 'PerformAuthRestarts': False,
 'RecoveryKeyFile': None,
 'ShowOptionalInstallsForHigherOSVersions': False,
 'SoftwareRepoCACertificate': None,
 'SoftwareRepoCAPath': None,
 'SoftwareRepoURL': DEFAULT_INSECURE_REPO_URL,
 'SoftwareUpdateServerURL': None,
コード例 #6
0
ファイル: prefs.py プロジェクト: jobare/munki
 'AdditionalHttpHeaders': None,
 'AppleSoftwareUpdatesOnly': False,
 'CatalogURL': None,
 'ClientCertificatePath': None,
 'ClientIdentifier': '',
 'ClientKeyPath': None,
 'ClientResourcesFilename': None,
 'ClientResourceURL': None,
 'DaysBetweenNotifications': 1,
 'FollowHTTPRedirects': 'none',
 'HelpURL': None,
 'IconURL': None,
 'IgnoreSystemProxies': False,
 'InstallRequiresLogout': False,
 'InstallAppleSoftwareUpdates': False,
 'LastNotifiedDate': NSDate.dateWithTimeIntervalSince1970_(0),
 'LocalOnlyManifest': None,
 'LogFile': '/Library/Managed Installs/Logs/ManagedSoftwareUpdate.log',
 'LoggingLevel': 1,
 'LogToSyslog': False,
 'ManagedInstallDir': '/Library/Managed Installs',
 'ManifestURL': None,
 'PackageURL': None,
 'PackageVerificationMode': 'hash',
 'PerformAuthRestarts': False,
 'RecoveryKeyFile': None,
 'ShowOptionalInstallsForHigherOSVersions': False,
 'SoftwareRepoCACertificate': None,
 'SoftwareRepoCAPath': None,
 'SoftwareRepoURL': 'http://munki/repo',
 'SoftwareUpdateServerURL': None,