Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow both list and glob matching #42058

Open
mitar opened this issue Jun 30, 2017 · 10 comments
Open

Allow both list and glob matching #42058

mitar opened this issue Jun 30, 2017 · 10 comments
Labels
Core relates to code central or existential to Salt Feature new functionality including changes to functionality and code refactors, etc.
Milestone

Comments

@mitar
Copy link
Contributor

mitar commented Jun 30, 2017

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
Copy link
Contributor

gtmanfred commented Jun 30, 2017

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
Copy link
Contributor Author

mitar commented Jun 30, 2017

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
Copy link
Contributor

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

@gtmanfred gtmanfred added Core relates to code central or existential to Salt Feature new functionality including changes to functionality and code refactors, etc. labels Jul 3, 2017
@gtmanfred gtmanfred added this to the Approved milestone Jul 3, 2017
@mew1033
Copy link
Contributor

mew1033 commented May 22, 2018

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

@stale
Copy link

stale bot commented Oct 4, 2019

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 stale bot added the stale label Oct 4, 2019
@mitar
Copy link
Contributor Author

mitar commented Oct 4, 2019

Unstale.

@stale
Copy link

stale bot commented Oct 4, 2019

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

@stale stale bot removed the stale label Oct 4, 2019
@stale
Copy link

stale bot commented Jan 7, 2020

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 stale bot added the stale label Jan 7, 2020
@mitar
Copy link
Contributor Author

mitar commented Jan 7, 2020

Unstale.

@stale
Copy link

stale bot commented Jan 7, 2020

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

@stale stale bot removed the stale label Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core relates to code central or existential to Salt Feature new functionality including changes to functionality and code refactors, etc.
Projects
None yet
Development

No branches or pull requests

3 participants