%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/pillar/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyc

�
���^c@@s�dZddlmZmZmZddlmZddlZddlm	Z	ej
e�Zyddl
mZeZWnek
r�eZnXd�Zde	fd	��YZd
�ZdS(u
Retrieve Pillar data by running a SQLCipher query

.. versionadded:: 2016.3.0

Python SQLCipher support is provided by the pysqlcipher
Python package. You need this module installed to query
Pillar data from a SQLCipher database.

This module is a concrete implementation of the sql_base
ext_pillar for SQLCipher.

:maturity: new
:depends: pysqlcipher (for py2) or pysqlcipher3 (for py3)
:platform: all

Configuring the sqlcipher ext_pillar
====================================

Use the 'sqlcipher' key under ext_pillar for configuration of queries.

SQLCipher database connection configuration requires the following values
configured in the master config:

   * ``sqlcipher.database`` - The SQLCipher database to connect to.
     Defaults to ``'/var/lib/salt/pillar-sqlcipher.db'``.
   * ``sqlcipher.pass`` - The SQLCipher database decryption password.
   * ``sqlcipher.timeout`` - The connection timeout in seconds.

Example configuration

.. code-block:: yaml

    sqlcipher:
      database: /var/lib/salt/pillar-sqlcipher.db
      pass: strong_pass_phrase
      timeout: 5.0

Complete Example
================

.. code-block:: yaml

    sqlcipher:
      database: '/var/lib/salt/pillar-sqlcipher.db'
      pass: strong_pass_phrase
      timeout: 5.0

    ext_pillar:
      - sqlcipher:
          fromdb:
            query: 'SELECT col1,col2,col3,col4,col5,col6,col7
                      FROM some_random_table
                     WHERE minion_pattern LIKE ?'
            depth: 5
            as_list: True
            with_lists: [1,3]
i(tabsolute_importtprint_functiontunicode_literals(tcontextmanagerN(tSqlBaseExtPillar(tdbapi2cC@sts
tStS(N(t
HAS_SQLCIPHERtFalsetTrue(((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyt__virtual__PstSQLCipherExtPillarcB@s5eZdZed��Zd�Zed��ZRS(uM
    This class receives and processes the database rows from SQLCipher.
    cC@sdS(Nu	SQLCipher((tcls((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyt_db_nameZscC@s�idd6dd6dd6}i}tjdi�}xL|D]D}||krptjd|�||||<q:n||||<q:W|S(	uD
        Returns options used for the SQLCipher connection.
        u!/var/lib/salt/pillar-sqlcipher.dbudatabaseustrong_pass_phraseupassg@utimeoutu	sqlcipheru%Using default for SQLCipher pillar %s(t__opts__tgettlogtdebug(tselftdefaultst_optionst_optstattr((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyt_get_options^s


cc@s�|j�}tj|jd�dt|jd���}|jdj|jd���|j�}z9y	|VWn)tjk
r�}t	j
d|j�nXWd|j�XdS(u*
        Yield a SQLCipher cursor
        udatabasettimeoututimeoutupragma key="{0}"upassu!Error in ext_pillar SQLCipher: %sN(
Rt	sqlciphertconnectRtfloattexecutetformattcursortErrorRt	exceptiontargstclose(RRtconnRterr((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyt_get_cursorps	(t__name__t
__module__t__doc__tclassmethodRRRR$(((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyR
Vs	cO@st�j||||�S(uG
    Execute queries against SQLCipher, merge and return as a dict
    (R
tfetch(t	minion_idtpillarR tkwargs((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyt
ext_pillar�s(R't
__future__RRRt
contextlibRtloggingtsalt.pillar.sql_baseRt	getLoggerR%RtpysqlcipherRRRRtImportErrorRR	R
R-(((s9/usr/lib/python2.7/site-packages/salt/pillar/sqlcipher.pyt<module>;s


	,

Zerion Mini Shell 1.0