%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/sdb/ |
Current File : //usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l m Z y d d l Z e Z Wn e k rm e Z n Xd d l m Z e j e � Z i d d 6Z d � Z e d � � Z d � Z d d � Z d d � Z d � Z d S( 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 ( t absolute_importt print_functiont unicode_literalsN( t uuid4( t memoizeu setu set_c C@ s t S( u/ Require the python2-couchdb libraries ( t HAS_COUCH( ( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt __virtual__; s c C@ s d j | � S( u� Examine configuration and return a uri for the couchdb server in the following format: .. code-block:: bash http://localhost:5984/ u http://{host}:{port}( t format( t profile( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt _construct_uriB s c C@ sF t | � p d } t j � } | d | k rB | j | d � n | S( u% Get a connection to CouchDB u http://localhost:5984u database( R t couchdbt Servert create( R t DEFAULT_BASE_URLt server( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt _get_connO s c C@ s- t | � } | j i t � j d 6| | 6� S( u) Set a key/value pair in couchdb u _id( t _get_dbt saveR t hex( t keyt valueR t db( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt set_[ s c C@ s t | � } | j | � S( u( Get a value from couchdb by id ( R t get( R R R ( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyR c s c C@ s t | � } t | � } | S( u* Wraps _get_conn() to return a db ( R R ( R R R ( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyR k s ( t __doc__t __future__R R R t loggingt uuidR R t TrueR t ImportErrort Falset salt.utils.decoratorsR t getLoggert __name__t logt __func_alias__R R R t NoneR R R ( ( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/couchdb.pyt <module>% s"