%PDF- %PDF-
| Direktori : /proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/modules/ |
| Current File : //proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/modules/cassandra.pyc |
�
���^c @@ s d Z d d l m Z m Z m Z d d l Z e j e � Z d d l Z
d d l m Z e
Z y d d l m Z e Z Wn e k
r� n Xd � Z d � Z d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z d � Z d d � Z d � Z d S( uE
Cassandra NoSQL Database Module
:depends: - pycassa Cassandra Python adapter
:configuration:
The location of the 'nodetool' command, host, and thrift port needs to be
specified via pillar::
cassandra.nodetool: /usr/local/bin/nodetool
cassandra.host: localhost
cassandra.thrift_port: 9160
i ( t absolute_importt unicode_literalst print_functionN( t six( t
SystemManagerc C@ s9 t s t d f St r/ t j j j d � r/ d St d f S( uH
Only load if pycassa is available and the system is configured
uG The cassandra execution module cannot be loaded: pycassa not installed.u nodetoolu cassandrauD The cassandra execution module cannot be loaded: nodetool not found.( t HAS_PYCASSAt Falset saltt utilst patht which( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt __virtual__ s
c C@ s= t d d � } t d d � } t d d j | | | � � S( u|
Internal cassandra nodetool wrapper. Some functions are not
available via pycassa so we must rely on nodetool.
u
config.optionu cassandra.nodetoolu cassandra.hostu cmd.run_stdoutu {0} -h {1} {2}( t __salt__t format( t cmdt nodetoolt host( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt _nodetool, s c C@ s? t j t d d � � } t d d � } t d j | | � � S( u;
Return a pycassa system manager connection object
u
config.optionu cassandra.THRIFT_PORTu cassandra.hostu {0}:{1}( R t text_typeR R R
( t thrift_portR ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt _sys_mgr6 s c C@ s
t d � S( u}
Return compactionstats info
CLI Example:
.. code-block:: bash
salt '*' cassandra.compactionstats
u compactionstats( R ( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt compactionstats? s
c C@ s
t d � S( uv
Return the cassandra version
CLI Example:
.. code-block:: bash
salt '*' cassandra.version
u version( R ( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt versionL s
c C@ s
t d � S( uo
Return netstats info
CLI Example:
.. code-block:: bash
salt '*' cassandra.netstats
u netstats( R ( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt netstatsY s
c C@ s
t d � S( um
Return tpstats info
CLI Example:
.. code-block:: bash
salt '*' cassandra.tpstats
u tpstats( R ( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt tpstatsf s
c C@ s
t d � S( uq
Return cassandra node info
CLI Example:
.. code-block:: bash
salt '*' cassandra.info
u info( R ( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt infos s
c C@ s
t d � S( uq
Return cassandra ring info
CLI Example:
.. code-block:: bash
salt '*' cassandra.ring
u ring( R ( ( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt ring� s
c C@ s t � } | j � S( uu
Return existing keyspaces
CLI Example:
.. code-block:: bash
salt '*' cassandra.keyspaces
( R t list_keyspaces( t sys( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt keyspaces� s
c C@ s� t � } | j � } | rG | | k r@ t | j | � j � � Sd Sn: i } x- | D]% } t | j | � j � � | | <qT W| Sd S( u�
Return existing column families for all keyspaces
or just the provided one.
CLI Example:
.. code-block:: bash
salt '*' cassandra.column_families
salt '*' cassandra.column_families <keyspace>
N( R R t listt get_keyspace_column_familiest keyst None( t keyspaceR t kspst rett kspace( ( s: /usr/lib/python2.7/site-packages/salt/modules/cassandra.pyt column_families� s
#c C@ sJ t � } y t | j | � | � SWn t k
rE t j d � d SXd S( u�
Return a dictionary of column family definitions for the given
keyspace/column_family
CLI Example:
.. code-block:: bash
salt '*' cassandra.column_family_definition <keyspace> <column_family>
u Invalid Keyspace/CF combinationN( R t varsR t Exceptiont logt debugR! ( R"