saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.15k stars 5.48k forks source link

Allow both list and glob matching #42058

Open mitar opened 7 years ago

mitar commented 7 years ago

Currently, one can or do a list matching or glob matching, but not both at the same time. But commas are not so common in server names, so I think that we could have both at the same time. This is at least what in most cases I would need. A simply way to list servers and sometimes to use some wildcard. I managed to implement this pretty easily in Python:

def match(servers, minion_id):
  for server_glob in servers.split(','):
    if fnmatch.fnmatch(minion_id, server_glob):
      return True

  return False
gtmanfred commented 7 years ago

Can you not do this with compound match?

salt -C L@minion1,minion2 or www* test.ping

https://docs.saltstack.com/en/latest/topics/targeting/compound.html

mitar commented 7 years ago

I guess I am just asking for alternative syntax. :-) Which is somewhere in between of all-powerful compound match and just a fixed list.

gtmanfred commented 7 years ago

I don't see a reason we couldn't allow the list to be a list of globs.

mew1033 commented 6 years ago

I assumed this would work (list matching with globs) and was disappointed when it didn't. 👍

stale[bot] commented 5 years ago

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.

mitar commented 5 years ago

Unstale.

stale[bot] commented 5 years ago

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

stale[bot] commented 4 years ago

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.

mitar commented 4 years ago

Unstale.

stale[bot] commented 4 years ago

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