salt icon indicating copy to clipboard operation
salt copied to clipboard

Wildcard or regex matching for grain keys when looking for values

Open Tanoti opened this issue 10 years ago • 13 comments

It would be useful if the grains.item and grains.get functions could take a wildcard or regex as the keys to look for. For example, if there are a number of grains with the same prefix (e.g. "ccs_") then something like "grains.item 'ccs_*' would allow a user to list the values of all those grains without having to know about and list each one separately. If it is not possible to modify these functions then maybe a new one called something like grains.match that takes type=<glob|pcre> and a filter?

Tanoti avatar Feb 05 '16 12:02 Tanoti

@Tanoti, thanks for the report. I think this should be supported for the pillar and mine data stores as well for utility and feature parity.

jfindlay avatar Feb 05 '16 18:02 jfindlay

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.

stale[bot] avatar Mar 16 '18 20:03 stale[bot]

I strongly feel this is a worthwhile improvement. If someone would care to point me at the right parts of the code, I would be happy to try and work out a patch.

Tanoti avatar Mar 17 '18 13:03 Tanoti

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Mar 17 '18 13:03 stale[bot]

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.

stale[bot] avatar Jun 30 '19 13:06 stale[bot]

Again, I strongly feel this is a worthwhile improvement. If someone would care to point me at the right parts of the code, I would be happy to try and work out a patch.

Tanoti avatar Jul 01 '19 08:07 Tanoti

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Jul 01 '19 08:07 stale[bot]

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.

stale[bot] avatar Jan 08 '20 10:01 stale[bot]

Again, I strongly feel this is a worthwhile improvement. If someone would care to point me at the right parts of the code, I would be happy to try and work out a patch.

Tanoti avatar Jan 08 '20 10:01 Tanoti

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Jan 08 '20 10:01 stale[bot]

I would also like to see this functionality added!

the-Fitz avatar Aug 04 '21 18:08 the-Fitz

bummer we don't have this functionality

jeff23ms avatar Nov 11 '22 14:11 jeff23ms

This would be a really nice option to have, I'm working through an issue right now trying to manage files using the pillar items but I have a situation like this:

websites:
  <site1>:
    site_SSL: <value>
  <site2>:
    site_SSL: <value>

and so on. I want to be able to target the data like this: websites:*:site_SSL

AllenRDCo avatar Jan 17 '23 17:01 AllenRDCo