Bug #12161
closedignored_environments.yml: Unable to include only class matching regex
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$/'
Updated by Dominic Cleal over 9 years ago
I don't think that's valid syntax. The exclamation mark is used in YAML deserialisation, it isn't negation of the regexp.
Updated by Adam Cécile over 9 years ago
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.
Updated by Dominic Cleal over 9 years ago
- 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.
Updated by E E almost 8 years ago
For other ending here, the documention for ignored_environments can be found here:
https://theforeman.org/manuals/latest/index.html#4.2.2Classes
Including how to make a reversed filter.
Updated by Adam Cécile almost 8 years ago
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.