Bug #12161
closed
ignored_environments.yml: Unable to include only class matching regex
Added by Adam Cécile over 9 years ago.
Updated almost 8 years ago.
Category:
Puppet integration
|
Description
Hello,
I created a /usr/share/foreman/config/ignored_environments.yml file containing:
:filters:
- ruby/regexp '/^role_/'
It's supposed to filter out all classes not matching the role_* name but it doesn't. Using the default example [1] which works the other way, I can confirm I see apt::params being filtered.
Thanks in advance,
Adam.
[1]
#:ignored:
# - test
:filters:
- !ruby/regexp '/params$/'
- !ruby/regexp '/base$/'
- !ruby/regexp '/install$/'
- !ruby/regexp '/service$/'
- !ruby/regexp '/config$/'
I don't think that's valid syntax. The exclamation mark is used in YAML deserialisation, it isn't negation of the regexp.
I actually found this kind of syntax in several user blog posts, that's really weird.
How would you write that kind of filter then ? I think an example of matching-only-filter should really be provided in the example config file.
- Status changed from New to Feedback
I don't have a suggestion, but I've double checked and that's not valid YAML, so indeed, it won't work. If you come up with something, please do submit it to our docs.
Hello,
I just tried creating the following file:
#:ignored:
# - test
#:filters:
# - !ruby/regexp '/params$/'
# - !ruby/regexp '/base$/'
# - !ruby/regexp '/install$/'
# - !ruby/regexp '/service$/'
# - !ruby/regexp '/config$/'
:filters:
- !ruby/regexp '/^(?!role_.*)$/'
Installed in both /etc/foreman/ignored_environments.yml and /usr/share/foreman/config/ignored_environments.yml.
When I list my puppet classes, I still see everything. If I remove some, and click import again, I'm prompted to reimport them...
So I still do not understand how to use this... Sorry.
Best regards, Adam.
Also available in: Atom
PDF