oslo-config-validator: invalidating configs only when necessary

Some nodes with no settings to invalidate as per their role will have
an empty config_invalidations list thus breaking the related tasks and
returning an error.

Skipping these tasks when config_invalidations is undefined will prevent
this false negative and will not block other nodes from runnnig the
tasks.

Also, adding some defaults to prevent failures when items are missing
from config.

Change-Id: Ib3ca74caf747c13937a4efa8c20a6fd789ede43b
(cherry picked from commit 9c62de3d4c)
(cherry picked from commit 6d8ea31cbc)
(cherry picked from commit ea51007651)
This commit is contained in:
David Vallee Delisle 2021-09-22 13:00:02 -04:00
parent 554d5c075d
commit bee63bba7c
2 changed files with 4 additions and 3 deletions

View File

@ -28,6 +28,7 @@
- name: Invalidate configuration
when:
- oslo_config_validator_invalid_settings | bool
- config_invalidations is defined
include_tasks: invalidate_config.yml
- name: Config validation reporting

View File

@ -41,10 +41,10 @@
- validated_configs is defined
set_fact:
validation_output: >-
{% set ignored_patterns = oslo_config_validator_global_ignored_messages %}{%
for ns in oslo_config_validator_namespaces_config %}{%
{% set ignored_patterns = oslo_config_validator_global_ignored_messages | default("") %}{%
for ns in oslo_config_validator_namespaces_config | default([]) %}{%
if ns.namespace in out.config_file.namespaces %}{%
for ignored in ns.ignored_messages %}{%
for ignored in ns.ignored_messages | default([]) %}{%
set _ = ignored_patterns.append(ignored) %}{%
endfor %}{%
endif %}{%