%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/zabbix_user.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l m Z m Z d d l m Z d d l m Z d d l m Z d � Z d d � Z d e d � Z d � Z d S( uR Management of Zabbix users. :codeauthor: Jiri Kotlin <jiri.kotlin@ultimum.io> i ( t absolute_importt print_functiont unicode_literals( t loadst dumps( t deepcopy( t six( t SaltExceptionc C@ s d t k S( uI Only make these states available if Zabbix module is available. u zabbix.user_create( t __salt__( ( ( s; /usr/lib/python2.7/site-packages/salt/states/zabbix_user.pyt __virtual__ s c K@ s| t d } d } d } i | d 6i d 6t d 6d d 6} g } i } | | d <d | k rk | d | d <n t d d d � } | r� | j | � n d | k r� | j | d � n | r� | j | � n t � } g | D]1 } | | k r� | j | � r� t j | � ^ q� } | j � | s/d | d <| S| d } | j | � x� | D]� } | | d <y t d | | � } Wn4 t k r�} d t j | � k r�t } q�� n X| rM| | k r�t | d <d | d <| SPqMqMW| rx| s?t d | d d d | | �} | rut | d <d t j | � d | d d <quqxd | d <d t j | � d t j | � d | d <n | S( uR Initial change of Zabbix Admin password to password taken from one of the sources (only the most prioritized one): 1. 'password' parameter 2. '_connection_password' parameter 3. pillar 'zabbix.password' setting 1) Tries to log in as Admin with password found in state password parameter or _connection_password or pillar or default zabbix password in this precise order, if any of them is present. 2) If one of above passwords matches, it tries to change the password to the most prioritized one. 3) If not able to connect with any password then it fails. :param name: Just a name of state :param password: Optional - desired password for Admin to be set :param _connection_user: Optional - Ignored in this state (always assumed 'Admin') :param _connection_password: Optional - zabbix password (can also be set in opts or pillar, see module's docstring) :param _connection_url: Optional - url of zabbix frontend (can also be set in opts, pillar, see module's docstring) .. code-block:: yaml # password taken from pillar or _connection_password zabbix-admin-password: zabbix_user.admin_password_present # directly set password zabbix-admin-password: zabbix_user.admin_password_present: - password: SECRET_PASS u testu Adminu zabbixu nameu changesu resultu u commentu _connection_useru _connection_urlu config.optionu zabbix.passwordu _connection_passworduD Could not find any Zabbix Admin password setting! See documentation.i u zabbix.user_getu# Login name or password is incorrectu Admin password is correct.u zabbix.user_updateu useridt passwdu changed to 'u 'u passwdu Password for user u updated to 'N( t __opts__t FalseR t Nonet appendt sett addR t text_typet reverseR t True( t namet passwordt kwargst dry_runt default_zabbix_usert default_zabbix_passwordt rett passwordst connection_argst config_passwordt seent xt unique_passwordst desired_passwordt pwdt user_gett errt user_update( ( s; /usr/lib/python2.7/site-packages/salt/states/zabbix_user.pyt admin_password_present sb " > % /c % K@ s� | d1 k r g } n i } d | k r8 | d | d <n d | k rU | d | d <n d | k rr | d | d <n i | d 6i d 6t d 6d d 6} d j | � } d j | � } d j | � } d j | � } i i d j | � d 6d j | � d 6| 6} d � } t d | | � } | r�t d | | � d } | d } t } t } t d d | | � } t � } x% | D] } | j t | d � � qrWt | � t | � k r�t } n t d | | � } | | � } | rjt | � } x( | D] } | j d � | j d � q�Wg | D] } | | k r| ^ qg | D] } | | k r9| ^ q9} | r�t } q�q�| r�| r�t } q�n t d r�| r�| s�| s�| r�d1 | d <| | d <q�t | d <| | d <q�d1 | d <| | d <n g } | rt | d <| s| s| r | | d <| r�t d | d | | �t d d | | � } t � } x% | D] } | j t | d � � q_Wt t | � t | � � } | r�| j d j | � � n t j | � | d d <n | r%t d | d | | �} d | k r| j | d � q%d! | d d"