Merge pull request #42560 from ArcaniteSolutions/improve_http_json_and_yaml

pillar/http_json and yaml: replace %s with minion_id in urls
This commit is contained in:
Mike Place 2017-08-22 14:39:55 -06:00 committed by GitHub
commit 9f0a64a137
2 changed files with 26 additions and 0 deletions

View file

@ -27,6 +27,16 @@ in <> brackets) in the url in order to populate pillar data based on the grain v
url: http://example.com/api/<nodename>
with_grains: True
.. versionchanged:: Oxygen
If %s is present in the url, it will be automaticaly replaced by the minion_id:
.. code-block:: yaml
ext_pillar:
- http_json:
url: http://example.com/api/%s
Module Documentation
====================
'''
@ -64,6 +74,9 @@ def ext_pillar(minion_id,
:return: A dictionary of the pillar data to add.
:rtype: dict
'''
url = url.replace('%s', _quote(minion_id))
grain_pattern = r'<(?P<grain_name>.*?)>'
if with_grains:

View file

@ -27,6 +27,16 @@ in <> brackets) in the url in order to populate pillar data based on the grain v
url: http://example.com/api/<nodename>
with_grains: True
.. versionchanged:: Oxygen
If %s is present in the url, it will be automaticaly replaced by the minion_id:
.. code-block:: yaml
ext_pillar:
- http_json:
url: http://example.com/api/%s
Module Documentation
====================
'''
@ -65,6 +75,9 @@ def ext_pillar(minion_id,
:return: A dictionary of the pillar data to add.
:rtype: dict
'''
url = url.replace('%s', _quote(minion_id))
grain_pattern = r'<(?P<grain_name>.*?)>'
if with_grains: