Merge pull request #27704 from jacobhammons/26604

Update compound matcher docs to clarify the usage of alternate delimi…
This commit is contained in:
Nicole Thomas 2015-10-05 23:36:55 -06:00
commit e47d849af6

View file

@ -10,19 +10,18 @@ with CLI and :term:`top file` matching. To match using anything other than a
glob, prefix the match string with the appropriate letter from the table below,
followed by an ``@`` sign.
====== ========= ==================== ==============================================================
Letter Delimiter Match Type Example
====== ========= ==================== ==============================================================
G x Grains glob ``G@os:Ubuntu``
E PCRE Minion ID ``E@web\d+\.(dev|qa|prod)\.loc``
P x Grains PCRE ``P@os:(RedHat|Fedora|CentOS)``
L List of minions ``L@minion1.example.com,minion3.domain.com or bl*.domain.com``
I x Pillar glob ``I@pdata:foobar``
J x Pillar PCRE ``J@pdata:^(foo|bar)$``
S Subnet/IP address ``S@192.168.1.0/24`` or ``S@192.168.1.100``
R Range cluster ``R@%foo.bar``
====== ========= ==================== ==============================================================
====== ==================== ============================================================== =============================================
Letter Match Type Example :ref:`Alt Delimiter? <target-alt-delimiters>`
====== ==================== ============================================================== =============================================
G Grains glob ``G@os:Ubuntu`` Yes
E PCRE Minion ID ``E@web\d+\.(dev|qa|prod)\.loc`` No
P Grains PCRE ``P@os:(RedHat|Fedora|CentOS)`` Yes
L List of minions ``L@minion1.example.com,minion3.domain.com or bl*.domain.com`` No
I Pillar glob ``I@pdata:foobar`` Yes
J Pillar PCRE ``J@pdata:^(foo|bar)$`` Yes
S Subnet/IP address ``S@192.168.1.0/24`` or ``S@192.168.1.100`` No
R Range cluster ``R@%foo.bar`` No
====== ==================== ============================================================== =============================================
Matchers can be joined using boolean ``and``, ``or``, and ``not`` operators.
@ -67,7 +66,7 @@ Excluding a minion based on its ID was also possible:
Precedence Matching
-------------------
Matches can be grouped together with parentheses to explicitly declare precedence amongst groups.
Matchers can be grouped together with parentheses to explicitly declare precedence amongst groups.
.. code-block:: bash
@ -78,16 +77,21 @@ Matches can be grouped together with parentheses to explicitly declare precedenc
Be certain to note that spaces are required between the parentheses and targets. Failing to obey this
rule may result in incorrect targeting!
.. _target-alt-delimiters:
Alternate Delimiters
--------------------
.. versionadded:: 2015.8.0
Some matchers allow an optional delimiter character specified between the
leading matcher character and the ``@`` pattern separator character. This
can be essential when the globbing or PCRE pattern may use the default
delimiter character ``:``. This avoids incorrect interpretation of the
pattern as part of the grain or pillar data structure traversal.
Matchers that target based on a key value pair use a colon (``:``) as
a delimiter. Matchers with a ``Yes`` in the ``Alt Delimiters`` column
in the previous table support specifying an alternate delimiter character.
This is done by specifying an alternate delimiter character between the leading
matcher character and the ``@`` pattern separator character. This avoids
incorrect interpretation of the pattern in the case that ``:`` is part of the
grain or pillar data structure traversal.
.. code-block:: bash