%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/redismod.pyo |
� ���^c @@ sn d Z d d l m Z m Z m Z d d l Z d Z d � Z d d d � Z d d � Z d d d d � Z d S( u| Management of Redis server ========================== .. versionadded:: 2014.7.0 :depends: - redis Python module :configuration: See :py:mod:`salt.modules.redis` for setup instructions. .. code-block:: yaml key_in_redis: redis.string: - value: string data The redis server information specified in the minion config file can be overridden in states using the following arguments: ``host``, ``post``, ``db``, ``password``. .. code-block:: yaml key_in_redis: redis.string: - value: string data - host: localhost - port: 6379 - db: 0 - password: somuchkittycat i ( t absolute_importt unicode_literalst print_functionNu redisc C@ s d t k r t St S( u6 Only load if the redis module is in __salt__ u redis.set_key( t __salt__t __virtualname__t False( ( ( s8 /usr/lib/python2.7/site-packages/salt/states/redismod.pyt __virtual__% s c K@ s� i | d 6i d 6t d 6d d 6} t d | | � } | | k rp t d | | | � d | d | <d | d <n | r� t d | | | � d j | � | d d <n4 | r� t d | | | � d j | � | d d <n | S( u) Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration time for key via UNIX timestamp, overrides `expire` u nameu changesu resultu Key already set to defined valueu commentu redis.get_keyu redis.set_keyu Value updatedu Key updated to new valueu redis.expireatu Key expires at {0}u expireatu redis.expireu TTL set to {0} secondsu expire( t TrueR t format( t namet valuet expiret expireatt connection_argst rett old_key( ( s8 /usr/lib/python2.7/site-packages/salt/states/redismod.pyt string. s c K@ s� i | d 6i d 6t d 6d d 6} | r� t | t � sO t | d <d | d <| Sg | D] } t d | | � rV | ^ qV } t | � s� | St d | | � | | d d <d | d <| St d | | � r� t d | | � d | d <| g | d d <n | S( u� Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used u nameu changesu resultu Key(s) specified already absentu commentu `keys` not formed as a list typeu redis.existsu redis.deleteu deletedu Keys deletedu Key deleted( R t isinstancet listR R t len( R t keysR R t keyt delete_list( ( s8 /usr/lib/python2.7/site-packages/salt/states/redismod.pyt absentT s, c K@ sk i | d 6i d 6t d 6d d 6} t j | � } t d | | | | � } | d t d � k r� t | d <d j | � | d <| St d | � } | | k r� t | d <d j | � | d <| St d t k r� d j | | d � | d <d | d <| S| j | � t d | � t d | � } | | k r2| St | d <i | d 6| d 6| d <d j | � | d <| S( u Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port Port of the sentinel to check for the master u nameu changesu resultu Failed to setup slaveu commentu redis.sentinel_get_master_ipu master_hostu network.ip_addrsu Minion is the master: {0}u redis.get_master_ipu# Minion already slave of master: {0}u testu'