I've been trying to create a compound match against the grain 'virtual_subtype' - the value I'm interested in is 'Xen PV DomU'.
Unfortunately, you can't use spaces as part of a value to match in a compound match because it's split in a fairly naive way using string.split() - see: https://github.com/saltstack/salt/blob/develop/salt/minion.py#L2704
I'd love some way to escape spaces in a compound match so it would be possible to match against the exact value rather than a glob of 'Xen?PV?DomU' or PCRE of 'XensPVsDomU'.
@tomjepp, thanks for the report. I suppose nobody has tried to compound match on grains containing spaces before.
You can use P@virtual_subtype:Xen\sPV\sDomU to match on grains with spaces.
@babilen I mentioned that as a specific workaround in the initial issue report!
"s" is any whitespace character though, so it would also match a tab (for example). So it's not an exact match still.
@tomjepp So you did. Sorry for the redundant information.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
This issue is still an issue in 2017.7.7. Please re-open.
# salt -C 'G@virtual:physical or G@virtual_subtype:"Xen Dom0"' test.ping returns nothing.
Some other tests I have tried:
# salt -C 'G@virtual_subtype:"Xen Dom0"' test.ping
# salt -C 'G@virtual_subtype:Xen Dom0' test.ping
# salt -C 'G@virtual_subtype:Xen\ Dom0' test.ping
# salt -C 'G@"virtual_subtype:Xen Dom0"' test.ping
# salt -C '"G@virtual_subtype:Xen Dom0"' test.ping
This is actually quite frustrating because there's no default grain to just say "match all physical hosts" since even dom-0 physical hosts return "xen" for the virtual grain.
Thank you for updating this issue. It is no longer marked as stale.
Still an issue in salt 2018.3.2:
# salt -C 'G@osfullname:Centos' grains.item osfullname
support.plymouth.edu:
----------
osfullname:
CentOS
...
# salt -C "G@osfullname:'Oracle Linux Server'" grains.item osfullname
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
# salt --version
salt 2018.3.2 (Oxygen)
And 2019.2.0 (Fluorine)
$ sudo salt 'test-vm1.test.local' grains.get manufacturer
test-vm1.test.local:
VMware, Inc.
$ sudo salt -C 'G@manufacturer:VMware, Inc.' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
$ salt --version
salt 2019.2.0 (Fluorine)
Workaround (wildcard)
sudo salt -C 'G@environment:test and G@osmajorrelease:5 and G@manufacturer:VMWare*' test.ping
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Still not fixed, please reopen.
Thank you for updating this issue. It is no longer marked as stale.
Still an issue with salt version: 3000.
(ZD-5301)
Reconfirmed in 3001rc1:
# salt -C 'G@foo:"foo x"' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
Master log excerpt:
2020-06-17 12:55:11,519 [salt.utils.minions:632 ][DEBUG ][244] Evaluating final compound matching expr: set() set()
2020-06-17 12:55:11,519 [salt.utils.minions:637 ][ERROR ][244] Invalid compound target: G@foo:"foo x"
@xeacott attempting to assign you this issue
Most helpful comment
This issue is still an issue in 2017.7.7. Please re-open.
# salt -C 'G@virtual:physical or G@virtual_subtype:"Xen Dom0"' test.pingreturns nothing.Some other tests I have tried:
This is actually quite frustrating because there's no default grain to just say "match all physical hosts" since even dom-0 physical hosts return "xen" for the
virtualgrain.