%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/output/ |
Current File : //usr/lib/python2.7/site-packages/salt/output/highstate.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z e j e � Z d � Z d d � Z d � Z e d � Z d � Z d S( u� Outputter for displaying results of state runs ============================================== The return data from the Highstate command is a standard data structure which is parsed by the highstate outputter to deliver a clean and readable set of information about the HighState run on minions. Two configurations can be set to modify the highstate outputter. These values can be set in the master config to change the output of the ``salt`` command or set in the minion config to change the output of the ``salt-call`` command. state_verbose By default `state_verbose` is set to `True`, setting this to `False` will instruct the highstate outputter to omit displaying anything in green, this means that nothing with a result of True and no changes will not be printed state_output: The highstate outputter has six output modes, ``full``, ``terse``, ``mixed``, ``changes`` and ``filter`` * The default is set to ``full``, which will display many lines of detailed information for each executed chunk. * If ``terse`` is used, then the output is greatly simplified and shown in only one line. * If ``mixed`` is used, then terse output will be used unless a state failed, in which case full output will be used. * If ``changes`` is used, then terse output will be used if there was no error and no changes, otherwise full output will be used. * If ``filter`` is used, then either or both of two different filters can be used: ``exclude`` or ``terse``. * for ``exclude``, state.highstate expects a list of states to be excluded (or ``None``) followed by ``True`` for terse output or ``False`` for regular output. Because of parsing nuances, if only one of these is used, it must still contain a comma. For instance: `exclude=True,`. * for ``terse``, state.highstate expects simply ``True`` or ``False``. These can be set as such from the command line, or in the Salt config as `state_output_exclude` or `state_output_terse`, respectively. The output modes have one modifier: ``full_id``, ``terse_id``, ``mixed_id``, ``changes_id`` and ``filter_id`` If ``_id`` is used, then the corresponding form will be used, but the value for ``name`` will be drawn from the state ID. This is useful for cases where the name value might be very long and hard to read. state_tabular: If `state_output` uses the terse output, set this to `True` for an aligned output format. If you wish to use a custom format, this can be set to a string. Example usage: If ``state_output: filter`` is set in the configuration file: .. code-block:: bash salt '*' state.highstate exclude=None,True means to exclude no states from the highstate and turn on terse output. .. code-block:: bash salt twd state.highstate exclude=problemstate1,problemstate2,False means to exclude states ``problemstate1`` and ``problemstate2`` from the highstate, and use regular output. Example output for the above highstate call when ``top.sls`` defines only one other state to apply to minion ``twd``: .. code-block:: text twd: Summary for twd ------------ Succeeded: 1 (changed=1) Failed: 0 ------------ Total states run: 1 Example output with no special settings in configuration files: .. code-block:: text myminion: ---------- ID: test.ping Function: module.run Result: True Comment: Module function test.ping executed Changes: ---------- ret: True Summary for myminion ------------ Succeeded: 1 Failed: 0 ------------ Total: 0 i ( t absolute_importt print_functiont unicode_literalsN( t sixc K@ s� g | j � D] } | j d � r | ^ q } d | j � k oO t | � d k } | rb | d =n d | k r� | j d � } n | j d d � } g t j | � D]% \ } } t | | d | �d ^ q� } | r� d j | � St j d | � d S( u� The HighState Outputter is only meant to be used with the state.highstate function, or a function that returns highstate return data. u .local_masteru retcodei u datau indent_levelt indent_leveli u uF Data passed to highstate outputter is not a valid highstate return: %su ( t keyst endswitht lent popt getR t iteritemst _format_hostt joint logt error( t datat kwargst keyt local_masterst orchestrator_outputR t hostt hostdatat ret( ( s9 /usr/lib/python2.7/site-packages/salt/output/highstate.pyt output� s .$ 8 i c 4 @ s� t j j j | � } t j j j t j d � t j d � � } t j d t � } i } g } | d } g } d } t j d t � } t � t � s� t � t j � r� d } | j d j | � | � � | d } n t � t � ra| d } | j d j | | � � xW � D]L } | r>t j j t j j j | � � } n | j d j | | | � � qWn t � t � r� i } x� t j � � D]� \ } } t | t � r�| d k r�| r�d | k r�d } | j d t j | � � | j d | � n t | t � r�d | k r�| | | <q�q�W| � x�t � d � f d � �D]�} � | } | j | d d � | | d c d 7<| j d d � } y | j t | � � Wnp t k r| j d � \ } } } y | j t | � � Wqt k rt j d | j d d � � qXn X| d } | j d � dg k r�t | d d d | d �} t j d dh | d | d t j! �} t } | d 7} n, t"