Project

General

Profile

Actions

Bug #12161

closed

ignored_environments.yml: Unable to include only class matching regex

Added by Adam Cécile over 8 years ago. Updated about 7 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
Puppet integration
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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$/'

Actions #1

Updated by Dominic Cleal over 8 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.

Actions #2

Updated by Adam Cécile over 8 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.

Actions #3

Updated by Dominic Cleal over 8 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.

Actions #4

Updated by E E about 7 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.

Actions #5

Updated by Adam Cécile about 7 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.

Actions

Also available in: Atom PDF