[PROPOSAL] Allow wildcard dependency #15
Labels
No Label
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#15
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Something just occurred to me, and I think, it'd be a great addition. Could also (partially) solve #843:
Long story short, I wrote a couple of types to help me set up my hosting infrastructure and a handful of vhosts on Apache. As a result, I can either
reload
/restart
theapache2
service quite often, or I need one long statement to restart at the end:Obviously, in practice it's much-much longer, which means it's rather clumsy, ugly, and error prone
So, I am proposing to extend the dependency resolver to allow wildcards, like this:
Supporting regular expressions or globs in
__require
has been suggested multiple times already (last I remember was on 2020-11-06 on Matrix), but adding that would make the already complex dependency resolver even more complex.Matrix log (reformatted):
Actually, this proposal was in discussion a while ago. The current way to go is to list all dependencies in the
require
before calling the type or write a variable like this:This doesn't coming handy, as it's pretty many things to write and to write wrong (cause you repeat some parts). You can automate the building of the
require
string with a function, but that won't be that easy.So the best option would be to wildcard match previous types in the
require
field. The proposed wildcard match on a type basis is fine, but can be annoying if you have many different types to match. By introducing greater wildcard matches, the scope becomes a more important topic. So you could just dorequire="*"
to reload the service at last.About the scope: What if we introduce them? So the basic wildcard character would match the current scope/manifest and a double wildcard character would match all scopes if we need to serve all needs?
Indeed. That's what I was referring to with the scoping issues...
The whole idea came about as I was toying with the following concept:
So, I either write a custom type for every single machine, and then have the luxury of a
gencode-remote
script, or go with the above rule of thumb, and put the actual config of the machines in (the) manifest(s).The wildcard feature would come in handy in the latter case.
Works in your 'top-level' type, but not if your type is a dependency.
Well, indeed, that's a risk here. However, in practice one would rather do something like this:
... at least in my mind.
But I do agree, it introduces the need to be careful; an – on a second thought – there could be a scoping issue here too...
I'm worried about the side effects here: it means you can't have
__module/anything
depend on__systemctl_service/apache2
. Won't have unsolvable dependency loops everywhere if we introduce this?