diff options
| author | Michal Arbet <michal.arbet@ultimum.io> | 2024-09-16 16:33:43 +0200 |
|---|---|---|
| committer | Michal Arbet <michal.arbet@ultimum.io> | 2024-09-16 21:23:39 +0200 |
| commit | ea198170bacf5735eaca22306011a24c1ea65532 (patch) | |
| tree | 0b5c8873178b59af9251da6b4de2e023a929f2b9 /docker/base | |
| parent | 6c5a443efe4e267639913e827918b83551318cab (diff) | |
| download | kolla-ea198170bacf5735eaca22306011a24c1ea65532.tar.gz kolla-ea198170bacf5735eaca22306011a24c1ea65532.zip | |
Fix state checking via kolla_set_configs
Kolla checks the status of its configurations
using kolla_set_configs --check. However, this
doesn't work for the command block in the config.json
file. This means that if only the command value changes,
but not the config_files block, which is common practice
in Kolla-Ansible btw, the container will not report the
changes.
This is undesirable and important to fix, especially
considering the planned rework of notifiers in
Kolla-Ansible [1].
[1] https://review.opendev.org/c/openstack/kolla-ansible/+/773243/14
Closes-Bug: #2080861
Change-Id: I2a290da38ea34b05ce3da8fb8b39b6252bf2da47
Diffstat (limited to 'docker/base')
| -rw-r--r-- | docker/base/set_configs.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 640e3e2d2..82e2e4589 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -57,6 +57,10 @@ class ConfigFileBadState(ExitingException): pass +class ConfigFileCommandDiffers(ExitingException): + pass + + class ConfigFile(object): def __init__(self, source, dest, owner=None, perm=None, optional=False, @@ -414,6 +418,15 @@ def execute_config_strategy(config): raise InvalidConfig('KOLLA_CONFIG_STRATEGY is not set properly') +def execute_command_check(config): + cmd = config.get('command') + with open("/run_command", "r") as f: + cmd_running = f.read() + if cmd != cmd_running: + msg = "Running command differs. " + cmd + " != " + cmd_running + raise ConfigFileCommandDiffers(msg) + + def execute_config_check(config): for data in config.get('config_files', []): config_file = ConfigFile(**data) @@ -431,6 +444,7 @@ def main(): config = load_config() if args.check: + execute_command_check(config) execute_config_check(config) else: execute_config_strategy(config) |
