%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/aptly.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlm	Z	ddl
mZddlZ
ddlZ
ddlZ
dZeje�ZdZd�Zd	�Zddddd
d�Zd�Zed
�Zeed�Zeed�Zedddddd
d�Zeddddd
d�Zeed�Z ed�Z!ed�Z"eed�Z#eed�Z$dS(u>
Aptly Debian repository manager.

.. versionadded:: 2018.3.0
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tSaltInvocationErroru/etc/aptly.confuaptlycC@s#tjjjd�rtStdfS(uI
    Only works on systems with the aptly binary in the system path.
    uaptlyuAThe aptly binaries required cannot be found or are not installed.(tsalttutilstpathtwhicht__virtualname__tFalse(((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt__virtual__scC@sX|jdd�td|dt�}|ddkrPtjd||d�n|dS(	u`
    Run the aptly command.

    :return: The string output of the command.
    :rtype: str
    iuaptlyucmd.run_alltignore_retcodeuretcodeu'Unable to execute command: %s
Error: %sustderrustdout(tinsertt__salt__tTruetlogtdebug(tcmdtcmd_ret((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt_cmd_run$subasec	C@s�t�}d}i|d6|d6|d6}|r`td||�}|s`tjd|�tSnx>|D]6}||dk	rg|jdj|||��qgqgW|r�|jdj|��n|S(	u�
    Format the common arguments for creating or editing a repository.

    :param str comment: The description of the repository.
    :param str component: The default component to use when publishing.
    :param str distribution: The default distribution to use when publishing.
    :param str uploaders_file: The repository upload restrictions config.
    :param str saltenv: The environment the file resides in.

    :return: A list of the arguments formatted as aptly arguments.
    :rtype: list
    ucommentu	componentudistributionu
cp.cache_fileu%Unable to get cached copy of file: %su-{}={}u-uploaders-file={}N(tlisttNoneRRterrorR
tappendtformat(	tcommentt	componenttdistributiontuploaders_filetsaltenvtrettcached_uploaders_pathtsettingstsetting((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt_format_repo_args5s	

$cC@sQtjd|�tjj|�sMdj|�}tj|�t|��ndS(u�
    Validate that the configuration file exists and is readable.

    :param str config_path: The path to the configuration file for the aptly instance.

    :return: None
    :rtype: None
    uChecking configuration file: %su$Unable to get configuration file: {}N(RRtosRtisfileRRR(tconfig_pathtmessage((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt_validate_configYs
	
cC@sAt|�dddj|�g}t|�}tjjj|�S(u
    Get the configuration data.

    :param str config_path: The path to the configuration file for the aptly instance.

    :return: A dictionary containing the configuration data.
    :rtype: dict

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.get_config
    uconfigushowu
-config={}(R(RRRRtjsontloads(R&RR((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt
get_configjs
cC@s�t|�t�}dddj|�dg}t|�}g|j�D]}|j�^qG}tjdt|��x-|D]%}t	d|d|d|�||<q|W|S(	uN
    List all of the repos.

    :param str config_path: The path to the configuration file for the aptly instance.
    :param bool with_packages: Return a list of packages in the repo.

    :return: A dictionary of the repositories.
    :rtype: dict

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.list_repos
    urepoulistu
-config={}u	-raw=trueuFound repositories: %stnameR&t
with_packages(
R(tdictRRt
splitlineststripRRtlentget_repo(R&R-RRRtlinetreposR,((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt
list_repos�s
	%
c	C@sWt|�tjt|��j�}t�}dddj|�dj|�|g}t|�}x�|j�D]�}y�|j	d�}|dj�j
dd�j�}d	j|j	��j
d	d
�}t
jjjt
jjj|dj���||<Wqnttfk
r%tjd|�qnXqnW|rCtjd
|�ntjd|�|S(u�
    Get the details of the repository.

    :param str name: The name of the repository.
    :param str config_path: The path to the configuration file for the aptly instance.
    :param bool with_packages: Return a list of packages in the repo.

    :return: A dictionary containing information about the repository.
    :rtype: dict

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.get_repo name="test-repo"
    urepoushowu
-config={}u-with-packages={}u:iudefaultuu u_iuSkipping line: %suFound repository: %suUnable to find repository: %s(R(Rt	text_typetbooltlowerR.RRR/tsplittreplaceR0tjoinRRtstringutilstto_nonetto_numtAttributeErrort
IndexErrorRR(	R,R&R-RRRR3titemstkey((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyR2�s&
	"!*cC@st|�tdd|d|�}|r=tjd|�tSdddj|�g}	td|d	|d
|d|d|�}
|	j|
�|	j|�|r�|	jd
d|g�nt	|	�tdd|d|�}|r�tjd|�tStj
d|�tS(uO
    Create the new repository.

    :param str name: The name of the repository.
    :param str config_path: The path to the configuration file for the aptly instance.
    :param str comment: The description of the repository.
    :param str component: The default component to use when publishing.
    :param str distribution: The default distribution to use when publishing.
    :param str uploaders_file: The repository upload restrictions config.
    :param str from_snapshot: The snapshot to initialize the repository contents from.
    :param str saltenv: The environment the file resides in.

    :return: A boolean representing whether all changes succeeded.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.new_repo name="test-repo" comment="Test main repo" component="main" distribution="trusty"
    uaptly.get_repoR,R&uRepository already exists: %surepoucreateu
-config={}RRRRRufromusnapshotuCreated repo: %suUnable to create repo: %s(R(RRRRRR#textendRRRR
(R,R&RRRRt
from_snapshotRtcurrent_repoRtrepo_paramstrepo((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pytnew_repo�s(



cC@s�t|�t�}i|d6|d6|d6}x7t|�D])}	||	dkr;|j|	d�q;q;Wtdd|d|�}
|
s�tjd|�tSx3t|
�D]%}||kr�|
j|d�q�q�W||
kr�tj	d|�t
Sd	d
dj|�g}td|d
|d|d|d|�}
|j
|
�|j|�t|�tdd|d|�}x=|D]5}	||	||	krt|ji||	|	6�qtqtW|r�tjd|�tStj	d|�t
S(u_
    Configure the repository settings.

    :param str name: The name of the repository.
    :param str config_path: The path to the configuration file for the aptly instance.
    :param str comment: The description of the repository.
    :param str component: The default component to use when publishing.
    :param str distribution: The default distribution to use when publishing.
    :param str uploaders_file: The repository upload restrictions config.
    :param str from_snapshot: The snapshot to initialize the repository contents from.
    :param str saltenv: The environment the file resides in.

    :return: A boolean representing whether all changes succeeded.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.set_repo name="test-repo" comment="Test universe repo" component="universe" distribution="xenial"
    ucommentu	componentudistributionuaptly.get_repoR,R&uUnable to get repo: %su;Settings already have the desired values for repository: %surepoueditu
-config={}RRRRRu0Unable to change settings for the repository: %suFSettings successfully changed to the desired values for repository: %sN(R(R.RRtpopRRRR
RRRR#RCRRtupdate(R,R&RRRRRtfailed_settingsR!R"tcurrent_settingstcurrent_settingRRFtnew_settings((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pytset_reposB
	




cC@s�t|�tjt|��j�}tdd|d|�}|sXtjd|�tSdddj	|�dj	|�|g}t
|�tdd|d|�}|r�tjd	|�tStjd
|�tS(u�
    Remove the repository.

    :param str name: The name of the repository.
    :param str config_path: The path to the configuration file for the aptly instance.
    :param bool force: Whether to remove the repository even if it is used as the source
        of an existing snapshot.

    :return: A boolean representing whether all changes succeeded.
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.delete_repo name="test-repo"
    uaptly.get_repoR,R&uRepository already absent: %surepoudropu
-config={}u	-force={}uUnable to remove repo: %suRemoved repo: %s(
R(RR6R7R8RRRRRRRR
(R,R&tforceRERRG((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pytdelete_repoOs

cC@spt|�dddj|�dg}t|�}g|j�D]}|j�^q>}tjdt|��|S(u
    Get a list of all the mirrors.

    :param str config_path: The path to the configuration file for the aptly instance.

    :return: A list of the mirror names.
    :rtype: list

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.list_mirrors
    umirrorulistu
-config={}u	-raw=trueuFound mirrors: %s(R(RRR/R0RRR1(R&RRR3R((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pytlist_mirrorsws
%cC@spt|�dddj|�dg}t|�}g|j�D]}|j�^q>}tjdt|��|S(u+
    Get a list of all the published repositories.

    :param str config_path: The path to the configuration file for the aptly instance.

    :return: A list of the published repository names.
    :rtype: list

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.list_published
    upublishulistu
-config={}u	-raw=trueu Found published repositories: %s(R(RRR/R0RRR1(R&RRR3R((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pytlist_published�s
%cC@s�t|�dddj|�dg}|r;|jd�n
|jd�t|�}g|j�D]}|j�^qa}tjdt|��|S(ue
    Get a list of all the snapshots.

    :param str config_path: The path to the configuration file for the aptly instance.
    :param bool sort_by_time: Whether to sort by creation time instead of by name.

    :return: A list of the snapshot names.
    :rtype: list

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.list_snapshots
    usnapshotulistu
-config={}u	-raw=trueu
-sort=timeu
-sort=nameuFound snapshots: %s(	R(RRRR/R0RRR1(R&tsort_by_timeRRR3R((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pytlist_snapshots�s

%cC@sYt|�tjt|��j�}it�d6t�d6}dddj|�dj|�dg}t|�}d}d	}d}x�|j	�D]�}|r�t
j||�}	|	r�d
j|�}
||
j|	j
d��q�d}n|s�t
j||�}	|	r|	j
d�}qq�q�Wtjd
t|d��tjdt|d��|S(u�
    Remove data regarding unreferenced packages and delete files in the package pool that
        are no longer being used by packages.

    :param bool dry_run: Report potential changes without making any changes.

    :return: A dictionary of the package keys and files that were removed.
    :rtype: dict

    CLI Example:

    .. code-block:: bash

        salt '*' aptly.cleanup_db
    udeleted_keysu
deleted_filesudbucleanupu
-config={}u-dry-run={}u
-verbose=trueu5^List\s+[\w\s]+(?P<package_type>(file|key)s)[\w\s]+:$u^\s+-\s+(?P<package>.*)$u
deleted_{}upackageupackage_typeu(Package keys identified for deletion: %su)Package files identified for deletion: %sN(R(RR6R7R8RRRRR/tretsearchRtgroupRRR1(R&tdry_runRRRttype_patterntlist_patternt
current_blockR3tmatchtpackage_type((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt
cleanup_db�s0


	(%t__doc__t
__future__RRRtloggingR$RVtsalt.extRtsalt.exceptionsRtsalt.utils.jsonRtsalt.utils.pathtsalt.utils.stringutilst_DEFAULT_CONFIG_PATHt	getLoggert__name__RR	RRRR#R(R+R
R5R2RHRORQRRRSRUR_(((s6/usr/lib/python2.7/site-packages/salt/modules/aptly.pyt<module>s<				#	 .		2	J( 

Zerion Mini Shell 1.0