%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlmZyddlZe	Z
Wnek
rmeZ
nXddl
mZeje�Zidd6Zd�Zed	��Zd
�Zdd�Zdd�Zd
�ZdS(u�
CouchDB sdb Module

:maintainer:    SaltStack
:maturity:      New
:depends:       python2-couchdb
:platform:      all

This allow interaction between Salt and a CouchDB [couchdb.apache.org]
database. It uses salt's `sdb` system to allow for inserts and retrevals
using the `sdb://` prefix in salt configuration files.

To use the couchbase sdb module, it must first be configured in the salt
master or minion config. The following arguments are required:

.. code-block:: yaml

    couchdb_sdb:
      driver: couchdb
      host: localhost
      port: 5984
      database: salt_sdb

One could then query the CouchDB instance via an `sdb://` URI such as the
following:

.. code-block:: yaml

    password: sdb://couchdb_sdb/mykey

To use this interface, you must track IDs on your own or have another source
to do the map-reduce logic necessary to calculate the ID you wish to fetch.

Additional contributions to build true map-reduce functionality into this module
would be welcome.
i(tabsolute_importtprint_functiontunicode_literalsN(tuuid4(tmemoizeusetuset_cC@stS(u/
    Require the python2-couchdb libraries
    (t	HAS_COUCH(((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt__virtual__;scC@s
dj|�S(u�
    Examine configuration and return
    a uri for the couchdb server in the following format:

    .. code-block:: bash

        http://localhost:5984/
    uhttp://{host}:{port}(tformat(tprofile((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt_construct_uriBs
cC@sFt|�pd}tj�}|d|krB|j|d�n|S(u%
    Get a connection to CouchDB
    uhttp://localhost:5984udatabase(R	tcouchdbtServertcreate(RtDEFAULT_BASE_URLtserver((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt	_get_connOs
cC@s-t|�}|jit�jd6||6�S(u)
    Set a key/value pair in couchdb
    u_id(t_get_dbtsaveRthex(tkeytvalueRtdb((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pytset_[scC@st|�}|j|�S(u(
    Get a value from couchdb by id
    (Rtget(RRR((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyRcscC@st|�}t|�}|S(u*
    Wraps _get_conn() to return a db
    (RR(RRR((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyRks(t__doc__t
__future__RRRtloggingtuuidRR
tTrueRtImportErrortFalsetsalt.utils.decoratorsRt	getLoggert__name__tlogt__func_alias__RR	RtNoneRRR(((s4/usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt<module>%s"



	
	

Zerion Mini Shell 1.0