%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/pillar/ |
Current File : //usr/lib/python2.7/site-packages/salt/pillar/http_yaml.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z y d d l m Z e Z Wn e k r} e Z n Xe j e � Z d � Z e d � Z d S( u� A module that adds data to the Pillar structure retrieved by an http request Configuring the HTTP_YAML ext_pillar ==================================== Set the following Salt config to setup an http endpoint as the external pillar source: .. code-block:: yaml ext_pillar: - http_yaml: url: http://example.com/api/minion_id ::TODO:: username: username password: password If the with_grains parameter is set, grain keys wrapped in can be provided (wrapped in <> brackets) in the url in order to populate pillar data based on the grain value. .. code-block:: yaml ext_pillar: - http_yaml: url: http://example.com/api/<nodename> with_grains: True .. versionchanged:: 2018.3.0 If %s is present in the url, it will be automatically replaced by the minion_id: .. code-block:: yaml ext_pillar: - http_json: url: http://example.com/api/%s Module Documentation ==================== i ( t absolute_importt print_functiont unicode_literalsN( t six( t quotec C@ s t S( N( t _HAS_DEPENDENCIES( ( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/http_yaml.pyt __virtual__? s c C@ s8 | j d t | � � } d } | r� x� t j | | � D]x } | j d � } t d | d � } | s| t j d | | � i St t j | � � } t j d j | � | | � } q7 Wn t j d | � t d d | d t d d � } d | k r� | d St j d | | � x% | D] } t j d | | | � qWi S( u� Read pillar data from HTTP response. :param str url: Url to request. :param bool with_grains: Whether to substitute strings in the url with their grain values. :return: A dictionary of the pillar data to add. :rtype: dict u %su <(?P<grain_name>.*?)>u grain_nameu grains.getu# Unable to get minion '%s' grain: %su <{0}>u Getting url: %su http.queryt urlt decodet decode_typeu yamlu dictu/ Error on minion '%s' http query: %s More Info: u %s: %sN( t replacet _quotet ret finditert groupt __salt__t Nonet logt errorR t text_typet subt formatt debugt True( t minion_idt pillarR t with_grainst grain_patternt matcht grain_namet grain_valuet datat key( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/http_yaml.pyt ext_pillarC s&