%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyo

�
���^c@@sGdZddlmZmZmZddlZddlZddlZddl	Zddl
ZddlZddlZddl
mZmZdZd�Zeed�Zeed�Zd	�Zd
�Zd�Zd�Zd
�Zeed�Zd�Zd�Zd�Zd�Zeed�Z d�Z!d�Z"d�Z#dS(u2
Support for the softwareupdate command on MacOS.
i(tabsolute_importtunicode_literalstprint_functionN(tCommandExecutionErrortSaltInvocationErrorusoftwareupdatecC@s tjjj�stdfStS(u
    Only for MacOS
    uRThe softwareupdate module could not be loaded: module only works on MacOS systems.(tsalttutilstplatformt	is_darwintFalset__virtualname__(((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt__virtual__s
c@s/ddg}tjjj|�}tjd�}tjjj|�rWtjd�}nddg��fd�}|j|�}i}x6|D].}||d�}	||d�}
|
||	<q�Wtjjj|�s�|Stjd�}|j|�}i}
x+|D]#}||kr|||
|<qqW|
S(	u
    Utility function to get all available update packages.

    Sample return date:
    { 'updatename': '1.2.3-45', ... }
    usoftwareupdateu--listu((?m)^   [*|-] ([^ ].*)[\r\n].*\(([^\)]+)u&(?m)^   [*] ([^ ].*)[\r\n].*\(([^\)]+)unameuversionc@s|�j|�S(N(tindex(tltk(tkeys(sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt<lambda><su&(?m)^   [*|-] ([^ ].*)[\r\n].*restart*(	RRt	mac_utilstexecute_return_resulttretcompiletdatatis_truetfindall(trecommendedtrestarttcmdtouttrexpt_gettupdatestrettlinetnametversion_numtrexp1trestart_updatestret_restarttupdate((RsC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt_get_available"s,

cC@s
t||�S(uL
    List all available updates.

    :param bool recommended: Show only recommended updates.

    :param bool restart: Show only updates that require a restart.

    :return: Returns a dictionary containing the updates
    :rtype: dict

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.list_available
    (R'(RR((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytlist_availableXscC@sE|jdd�d}dd|g}tjjj|�|t�kS(u-
    Ignore a specific program update. When an update is ignored the '-' and
    version number at the end will be omitted, so "SecUpd2014-001-1.0" becomes
    "SecUpd2014-001". It will be removed automatically if present. An update
    is successfully ignored when it no longer shows up after list_updates.

    :param name: The name of the update to add to the ignore list.
    :ptype: str

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.ignore <update-name>
    u-iiusoftwareupdateu--ignore(trsplitRRRtexecute_return_successtlist_ignored(R!t	to_ignoreR((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytignorelscC@s@dddg}tjjj|�}tjd�}|j|�S(uE
    List all updates that have been ignored. Ignored updates are shown
    without the '-' and version number at the end, this is how the
    softwareupdate command works.

    :return: The list of ignored updates
    :rtype: list

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.list_ignored
    usoftwareupdateu--listu--ignoreu'(?m)^    ["]?([^,|\s].*[^"|\n|,])[,|"]?(RRRRRRR(RRR((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyR+�scC@s,ddg}tjjj|�t�gkS(u#
    Make sure the ignored updates are not ignored anymore,
    returns a list of the updates that are no longer ignored.

    :return: True if the list was reset, Otherwise False
    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.reset_ignored
    usoftwareupdateu--reset-ignored(RRRR*R+(R((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt
reset_ignored�scC@sJddg}tjjj|�}|j�d}tjjj|�dkS(u�
    Check the status of automatic update scheduling.

    :return: True if scheduling is enabled, False if disabled

    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.schedule_enabled
    usoftwareupdateu
--schedulei����uon(RRRRtsplittvalidate_enabled(RRtenabled((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytschedule_enabled�scC@sbtjjj|�}ddtjjj|�g}tjjj|�tjjjt��|kS(u�
    Enable/disable automatic update scheduling.

    :param enable: True/On/Yes/1 to turn on automatic updates. False/No/Off/0
        to turn off automatic updates. If this value is empty, the current
        status will be returned.

    :type: bool str

    :return: True if scheduling is enabled, False if disabled
    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.schedule_enable on|off
    usoftwareupdateu
--schedule(RRRR0R*R2(tenabletstatusR((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytschedule_enable�scC@s�t||�}|siSx0|D](}dd|g}tjjj|�q Wi}t�}x*|D]"}||krztnt||<qbW|S(u�
    Install all available updates. Returns a dictionary containing the name
    of the update and the status of its installation.

    :param bool recommended: If set to True, only install the recommended
        updates. If set to False (default) all updates are installed.

    :param bool restart: Set this to False if you do not want to install updates
        that require a restart. Default is True

    :return: A dictionary containing the updates that were installed and the
        status of its installation. If no updates were installed an empty
        dictionary is returned.

    :rtype: dict

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.update_all
    usoftwareupdateu	--install(R'RRRR*tTrueR	(RRt	to_updatet_updateRRtupdates_left((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt
update_all�s
	
 cC@sQt|�s$tdj|���ndd|g}tjjj|�t|�S(u
    Install a named update.

    :param str name: The name of the of the update to install.

    :return: True if successfully updated, otherwise False
    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.update <update-name>
    uUpdate not available: {0}usoftwareupdateu	--install(tupdate_availableRtformatRRRR*(R!R((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyR&s
cC@s
|t�kS(uv
    Check whether or not an update is available with a given name.

    :param str name: The name of the update to look for

    :return: True if available, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.update_available <update-name>
       salt '*' softwareupdate.update_available "<update with whitespace>"
    (R'(R!((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyR;,sc		C@s g}xStjjjd�D]<\}}}x*|D]"}|jtjj||��q2WqWg}x-|D]%}|jd�ri|j|�qiqiWg}x�t�D]v}xm|D]e}tjj	j
|��H}|jdd�dtjjj
|j��kr|j|�nWdQXq�Wq�W|S(u�
    Return a list of all updates that have been downloaded locally.

    :return: A list of updates that have been downloaded
    :rtype: list

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.list_downloads
    u/Library/Updatesu.distu-iiN(RRtpathtos_walktappendtostjointendswithR'tfilestfopenR)tstringutilst
to_unicodetread(	toutfilestroott	subFolderRCtft
dist_filesRR&tfhr((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytlist_downloads?s
%
$

1cC@sft|�s$tdj|���n|t�kr7tSdd|g}tjjj|�|t�kS(uK
    Download a named update so that it can be installed later with the
    ``update`` or ``update_all`` functions

    :param str name: The update to download.

    :return: True if successful, otherwise False
    :rtype: bool

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.download <update name>
    uUpdate not available: {0}usoftwareupdateu
--download(	R;RR<RNR6RRRR*(R!R((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytdownload`scC@s1t||�}x|D]}t|�qWt�S(u~
    Download all available updates so that they can be installed later with the
    ``update`` or ``update_all`` functions. It returns a list of updates that
    are now downloaded.

    :param bool recommended: If set to True, only install the recommended
        updates. If set to False (default) all updates are installed.

    :param bool restart: Set this to False if you do not want to install updates
        that require a restart. Default is True

    :return: A list containing all downloaded updates on the system.
    :rtype: list

    CLI Example:

    .. code-block:: bash

       salt '*' softwareupdate.download_all
    (R'RORN(RRtto_downloadR!((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytdownload_all|s
cC@s�dddg}tjjj|�}d|krV|jd�tjjj|�}|Sd|kr�|jd�tjjj|�}|SdSdS(ur
    .. versionadded:: 2016.3.0

    Get the current catalog being used for update lookups. Will return a url if
    a custom catalog has been specified. Otherwise the word 'Default' will be
    returned

    :return: The catalog being used for update lookups
    :rtype: str

    CLI Example:

    .. code-block:: bash

        salt '*' softwareupdates.get_catalog
    udefaultsureadu3/Library/Preferences/com.apple.SoftwareUpdate.plistuAppleCatalogURLu
CatalogURLuDefaultN(RRRRR?(RR((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytget_catalog�s	

cC@sIdd|g}ytjjj|�Wntk
r;}nXt�|kS(uS
    .. versionadded:: 2016.3.0

    Set the Software Update Catalog to the URL specified

    :param str url: The url to the update catalog

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' softwareupdates.set_catalog http://swupd.local:8888/index.sucatalog
    usoftwareupdateu
--set-catalog(RRRR*RRR(turlRtexc((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pytset_catalog�scC@sFddg}ytjjj|�Wntk
r8}nXt�dkS(u�
    .. versionadded:: 2016.3.0

    Reset the Software Update Catalog to the default.

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' softwareupdates.reset_catalog
    usoftwareupdateu--clear-cataloguDefault(RRRR*RRR(RRT((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt
reset_catalog�s($t__doc__t
__future__RRRRR@tsalt.utils.dataRtsalt.utils.filestsalt.utils.pathtsalt.utils.mac_utilstsalt.utils.platformtsalt.exceptionsRRR
RR	R'R(R-R+R.R2R5R6R:R&R;RNRORQRRRURV(((sC/usr/lib/python2.7/site-packages/salt/modules/mac_softwareupdate.pyt<module>s6	6					)			!		"	

Zerion Mini Shell 1.0