%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlmZddlZ	ej
e�Zd�Z
dd�Zd�Zdd�Zd	�Zed
�Zd�Zd�Zd
�Zd�ZdS(uC
State module to manage Elasticsearch.

.. versionadded:: 2017.7.0
i(tabsolute_importtprint_functiontunicode_literalsN(tsixcC@s0i|d6id6td6dd6}y�tdd|�}|r�||kr�tdr�d	j|�|d<|||dd
<d|d<q�tdd|�|d<|dr�dj|�|d<|||dd
<q�d
j|�|d<ndj|�|d<Wn0tk
r+}t|d<tj|�|d<nX|S(u^
    Ensure that the named index is absent.

    name
        Name of the index to remove
    unameuchangesuresultuucommentuelasticsearch.index_gettindexutestuIndex {0} will be removeduolduelasticsearch.index_deleteuSuccessfully removed index {0}u.Failed to remove index {0} for unknown reasonsuIndex {0} is already absentN(	tTruet__salt__t__opts__tformattNonet	ExceptiontFalseRt	text_type(tnametretRterr((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytindex_absents$"



cC@s>i|d6id6td6dd6}y�tdd|�}|s�tdryd	j|�|d<i|d
6|d<d|d<qtdd|d|�}|r�d
j|�|d<itdd|�|d
6|d<qt|d<dj||�|d<ndj|�|d<Wn0tk
r9}t|d<tj|�|d<nX|S(uJ
    Ensure that the named index is present.

    name
        Name of the index to add
    definition
        Optional dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

    **Example:**

    .. code-block:: yaml

        # Default settings
        mytestindex:
          elasticsearch_index.present

        # Extra settings
        mytestindex2:
          elasticsearch_index.present:
            - definition:
                settings:
                  index:
                    number_of_shards: 10
    unameuchangesuresultuucommentuelasticsearch.index_existsRutestu,Index {0} does not exist and will be createdunewuelasticsearch.index_createtbodyuSuccessfully created index {0}uelasticsearch.index_getuCannot create index {0}, {1}uIndex {0} is already presentN(	RRRRR	RR
RR(R
t
definitionRtindex_existstoutputR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pyt
index_present4s&"

%

cC@s�i|d6id6td6dd6}yStdd|d|�}|r^|j|i�jd	i�j|d�dk	r^td
r�dj||�|d<|j|i�jd	i�j|i�|dd<d|d<qttd
d|d|�|d<|drEdj||�|d<|j|i�jd	i�j|i�|dd<qtdj||�|d<ndj||�|d<Wn0tk
r�}t|d<tj	|�|d<nX|S(u�
    Ensure that the index alias is absent.

    name
        Name of the index alias to remove
    index
        Name of the index for the alias
    unameuchangesuresultuucommentuelasticsearch.alias_gettaliasestindicesualiasesutestu'Alias {0} for index {1} will be removeduolduelasticsearch.alias_deleteu,Successfully removed alias {0} for index {1}u<Failed to remove alias {0} for index {1} for unknown reasonsu)Alias {0} for index {1} is already absentN(
RRtgetR	RRR
RRR(R
RRtaliasR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytalias_absenths$
"6
2

5
cC@s�i|d6id6td6dd6}yrtdd|d|�}i}|rw|j|i�jd	i�j|i�}n|s�i}ntd
||�|d<|ds�|r}tdr�|s�dj||�|d<nd
j||�|d<d|d<q�tdd|d|d|�}|rW|s>dj||�|d<qzdj||�|d<q�t|d<dj|||�|d<ndj||�|d<Wn0tk
r�}t|d<t	j
|�|d<nX|S(u�
    Ensure that the named index alias is present.

    name
        Name of the alias
    index
        Name of the index
    definition
        Optional dict for filters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

    **Example:**

    .. code-block:: yaml

        mytestalias:
          elasticsearch.alias_present:
            - index: testindex
            - definition:
                filter:
                  term:
                    user: kimchy
    unameuchangesuresultuucommentuelasticsearch.alias_getRRualiasesudictdiffer.deep_diffutestu:Alias {0} for index {1} does not exist and will be createduNAlias {0} for index {1} exists with wrong configuration and will be overriddenuelasticsearch.alias_createRRu,Successfully created alias {0} for index {1}u-Successfully replaced alias {0} for index {1}u*Cannot create alias {0} for index {1}, {2}u*Alias {0} for index {1} is already presentN(RRRt	__utils__RRR	RR
RR(R
RRRRtoldRR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pyt
alias_present�s6"-	



cC@s0i|d6id6td6dd6}y�tdd|�}|r�||kr�tdr�d	j|�|d<|||dd
<d|d<q�tdd|�|d<|dr�dj|�|d<|||dd
<q�d
j|�|d<ndj|�|d<Wn0tk
r+}t|d<tj|�|d<nX|S(ug
    Ensure that the named index template is absent.

    name
        Name of the index to remove
    unameuchangesuresultuucommentu elasticsearch.index_template_getR
utestu"Index template {0} will be removeduoldu#elasticsearch.index_template_deleteu'Successfully removed index template {0}u7Failed to remove index template {0} for unknown reasonsu$Index template {0} is already absentN(	RRRRR	R
RRR(R
Rtindex_templateR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytindex_template_absent�s$"



cC@s�i|d6id6td6dd6}y7tdd|�}|s�tdryd	j|�|d<i|d
6|d<d|d<qXtdd|d|�}|r�d
j|�|d<itdd|�|d
6|d<qXt|d<dj||�|d<ne|rEt|t�r tj	j
j|�}n|}tdd|�|}x4dD],}||ikrD||krD||=qDqDWtd||�}	t
|	�dkr/tdr�dj|�|d<|	|d<d|d<qBtdd|d|�}|rdj|�|d<|	|d<qBt|d<dj||�|d<qXdj|�|d<ndj|�|d<Wn0tk
r�}
t|d<tj|
�|d<nX|S(uq
    Ensure that the named index template is present.

    name
        Name of the index to add
    definition
        Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
    check_definition
        If the template already exists and the definition is up to date

    **Example:**

    .. code-block:: yaml

        mytestindex2_template:
          elasticsearch.index_template_present:
            - definition:
                template: logstash-*
                order: 1
                settings:
                  number_of_shards: 1
    unameuchangesuresultuucommentu#elasticsearch.index_template_existsR
utestu5Index template {0} does not exist and will be createdunewu#elasticsearch.index_template_createRu'Successfully created index template {0}u elasticsearch.index_template_getu%Cannot create index template {0}, {1}umappingsualiasesusettingsudictdiffer.deep_diffiu/Index template {0} exist but need to be updatedu'Successfully updated index template {0}u%Cannot update index template {0}, {1}u4Index template {0} is already present and up to dateu%Index template {0} is already presentN(umappingsualiasesusettings(RRRRR	Rt
isinstancetstrtsalttutilstjsontloadsRtlenR
RR(R
Rtcheck_definitionRtindex_template_existsRtdefinition_parsedtcurrent_templatetkeytdiffR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytindex_template_present�sP"

%







cC@s0i|d6id6td6dd6}y�tdd|�}|r�||kr�tdr�d	j|�|d<|||dd
<d|d<q�tdd|�|d<|dr�dj|�|d<|||dd
<q�d
j|�|d<ndj|�|d<Wn0tk
r+}t|d<tj|�|d<nX|S(uc
    Ensure that the named pipeline is absent

    name
        Name of the pipeline to remove
    unameuchangesuresultuucommentuelasticsearch.pipeline_gettidutestuPipeline {0} will be removeduolduelasticsearch.pipeline_deleteu!Successfully removed pipeline {0}u1Failed to remove pipeline {0} for unknown reasonsuPipeline {0} is already absentN(	RRRRR	R
RRR(R
RtpipelineR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytpipeline_absent8s$"



cC@s�i|d6id6td6dd6}y1tdd|�}i}|r]||kr]||}ntd||�|d<|ds�|r?td	r�|s�d
j|�|d<ndj|�|d<d|d<qRtdd|d
|�}|r|sdj|�|d<q<dj|�|d<qRt|d<dj||�|d<ndj|�|d<Wn0tk
r�}t|d<tj	|�|d<nX|S(uX
    Ensure that the named pipeline is present.

    name
        Name of the index to add
    definition
        Required dict for creation parameters as per https://www.elastic.co/guide/en/elasticsearch/reference/master/pipeline.html

    **Example:**

    .. code-block:: yaml

        test_pipeline:
          elasticsearch.pipeline_present:
            - definition:
                description: example pipeline
                processors:
                  - set:
                      field: collector_timestamp_millis
                      value: '{{ '{{' }}_ingest.timestamp{{ '}}' }}'
    unameuchangesuresultuucommentuelasticsearch.pipeline_getR.udictdiffer.deep_diffutestu/Pipeline {0} does not exist and will be createduCPipeline {0} exists with wrong configuration and will be overriddenuelasticsearch.pipeline_createRu!Successfully created pipeline {0}u"Successfully replaced pipeline {0}uCannot create pipeline {0}, {1}uPipeline {0} is already presentN(
RRRRRR	RR
RR(R
RRR/RRR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytpipeline_presentYs2"




cC@sBi|d6id6td6dd6}y�tdd|�}|r�tdr�d	j|�|d<tjjj|d
�|dd<d|d<q
tdd|�|d<|dr�d
j|�|d<tjjj|d
�|dd<q
dj|�|d<ndj|�|d<Wn0t	k
r=}t
|d<tj|�|d<nX|S(uk
    Ensure that the search template is absent

    name
        Name of the search template to remove
    unameuchangesuresultuucommentu!elasticsearch.search_template_getR.utestu#Search template {0} will be removedutemplateuoldu$elasticsearch.search_template_deleteu(Successfully removed search template {0}u8Failed to remove search template {0} for unknown reasonsu%Search template {0} is already absentN(
RRRRR"R#R$R%R	R
RRR(R
RttemplateR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytsearch_template_absent�s$"
!

$
cC@s�i|d6id6td6dd6}y4tdd|�}i}|r`tjjj|d�}ntd	||�|d<|ds�|rBtd
r�|s�dj|�|d<ndj|�|d<d|d<qUtd
d|d|�}|r|s	dj|�|d<q?dj|�|d<qUt
|d<dj||�|d<ndj|�|d<Wn0tk
r�}t
|d<tj
|�|d<nX|S(u�
    Ensure that the named search template is present.

    name
        Name of the search template to add
    definition
        Required dict for creation parameters as per http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html

    **Example:**

    .. code-block:: yaml

        test_pipeline:
          elasticsearch.search_template_present:
            - definition:
                inline:
                  size: 10
    unameuchangesuresultuucommentu!elasticsearch.search_template_getR.utemplateudictdiffer.deep_diffutestu6Search template {0} does not exist and will be createduJSearch template {0} exists with wrong configuration and will be overriddenu$elasticsearch.search_template_createRu(Successfully created search template {0}u)Successfully replaced search template {0}u&Cannot create search template {0}, {1}u&Search template {0} is already presentN(RRR"R#R$R%RRRR	RR
RR(R
RRR2RRR((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pytsearch_template_present�s2"



(t__doc__t
__future__RRRtloggingtsalt.extRtsalt.utils.jsonR"t	getLoggert__name__tlogRR	RRRRRR-R0R1R3R4(((s=/usr/lib/python2.7/site-packages/salt/states/elasticsearch.pyt<module>s	!4	#?	!M	!	;	!

Zerion Mini Shell 1.0