Skip to content

Commit ea19817

Browse files
committed
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
1 parent 6c5a443 commit ea19817

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

docker/base/set_configs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class ConfigFileBadState(ExitingException):
5757
pass
5858

5959

60+
class ConfigFileCommandDiffers(ExitingException):
61+
pass
62+
63+
6064
class ConfigFile(object):
6165

6266
def __init__(self, source, dest, owner=None, perm=None, optional=False,
@@ -414,6 +418,15 @@ def execute_config_strategy(config):
414418
raise InvalidConfig('KOLLA_CONFIG_STRATEGY is not set properly')
415419

416420

421+
def execute_command_check(config):
422+
cmd = config.get('command')
423+
with open("/run_command", "r") as f:
424+
cmd_running = f.read()
425+
if cmd != cmd_running:
426+
msg = "Running command differs. " + cmd + " != " + cmd_running
427+
raise ConfigFileCommandDiffers(msg)
428+
429+
417430
def execute_config_check(config):
418431
for data in config.get('config_files', []):
419432
config_file = ConfigFile(**data)
@@ -431,6 +444,7 @@ def main():
431444
config = load_config()
432445

433446
if args.check:
447+
execute_command_check(config)
434448
execute_config_check(config)
435449
else:
436450
execute_config_strategy(config)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed an issue where ``kolla_set_configs --check`` failed to detect
5+
changes in the ``command`` block of ``config.json`` file.
6+
`LP#2080861 <https://bugs.launchpad.net/bugs/2080861>`__

0 commit comments

Comments
 (0)