Merge "oslo_config_validator: Adding possibility to override namespaces config"

This commit is contained in:
Zuul 2022-03-18 17:18:17 +00:00 committed by Gerrit Code Review
commit 7b5196adfe
3 changed files with 36 additions and 2 deletions

View File

@ -29,6 +29,21 @@
- identity
products:
- tripleo
# Overriding simple namespaces config can be done on a per-namespace basis.
# We simply need to add a dict to this list of dictionnary. It will replace
# its corresponding entry from the default config
# This is usefull if we want to target the validation on a set of hosts
# that would otherwise trigger an error.
# oslo_config_validator_namespaces_config_override:
# - namespace: nova.conf
# invalid_settings:
# - section: filter_scheduler
# option: enabled_filters
# separator: ","
# value_list:
# - SomeBadFilter
# Debug log level
oslo_config_validator_debug: false
@ -68,5 +83,6 @@
- placement
- neutron
- keystone
roles:
- oslo_config_validator

View File

@ -44,6 +44,24 @@
debug:
var: service_config
- name: Overriding namespace configuration
set_fact:
namespaces_config: >-
{% set override_config = [] %}{%
for config in oslo_config_validator_namespaces_config | default([]) %}{%
set _ = override_config.append(
oslo_config_validator_namespaces_config_override | default([]) |
selectattr('namespace', 'eq', config.namespace) | first | default(config, true)
) %}{%
endfor %}{{
override_config }}
- name: Printing overriden namespace config
when:
- oslo_config_validator_debug | bool
debug:
var: namespaces_config
- name: podman - Gather facts for all containers
become: true
containers.podman.podman_container_info:
@ -133,7 +151,7 @@
%}{%
if svc_config | count %}{%
for ns in svc_config[0].namespaces | list %}{%
set ns_config = oslo_config_validator_namespaces_config |
set ns_config = namespaces_config |
selectattr('namespace', 'equalto', ns) |
selectattr('invalid_settings', 'defined') | list %}{%
if ns_config | count %}{%

View File

@ -42,7 +42,7 @@
set_fact:
validation_output: >-
{% set ignored_patterns = oslo_config_validator_global_ignored_messages | default("") %}{%
for ns in oslo_config_validator_namespaces_config | default([]) %}{%
for ns in namespaces_config | default([]) %}{%
if ns.namespace in out.config_file.namespaces %}{%
for ignored in ns.ignored_messages | default([]) %}{%
set _ = ignored_patterns.append(ignored) %}{%