Skip to content

Commit 8ff73a2

Browse files
authored
Merge pull request #433 from stackhpc/upstream/master-2025-06-30
Synchronise master with upstream
2 parents 537118f + b56331c commit 8ff73a2

File tree

10 files changed

+121
-40
lines changed

10 files changed

+121
-40
lines changed

docker/base/set_configs.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class ConfigFileCommandDiffers(ExitingException):
6868
pass
6969

7070

71+
class StateMismatch(ExitingException):
72+
pass
73+
74+
7175
class ConfigFile(object):
7276

7377
def __init__(self, source, dest, owner=None, perm=None, optional=False,
@@ -583,6 +587,56 @@ def execute_command_check(config):
583587

584588

585589
def execute_config_check(config):
590+
"""Check configuration state consistency and validate config file entries.
591+
592+
This function compares the current config file destinations from the
593+
provided config dictionary with those stored in the defaults state file.
594+
If any destinations are found in the state file but not in the config,
595+
a StateMismatch exception is raised. These missing files would otherwise
596+
be restored or removed depending on their backup state.
597+
598+
After validating consistency, the function performs standard checks on
599+
each declared configuration file, including content, permissions, and
600+
ownership validation.
601+
602+
Args:
603+
config (dict): The configuration dictionary containing 'config_files'
604+
entries as expected by Kolla.
605+
606+
Raises:
607+
StateMismatch: If there are entries in the defaults state not present
608+
in the provided config.
609+
"""
610+
state = get_defaults_state()
611+
612+
# Build a set of all current destination paths from config.json
613+
# If the destination is a directory, we append the
614+
# basename of the source
615+
current_dests = {
616+
entry['dest'] if not entry['dest'].endswith('/') else
617+
os.path.join(entry['dest'], os.path.basename(entry['source']))
618+
for entry in config.get('config_files', [])
619+
if entry.get('dest')
620+
}
621+
622+
# Detect any paths that are present in the state file but
623+
# missing from config.json.
624+
# These would be either restored (if state[dest] has a backup)
625+
# or removed (if dest is null)
626+
removed_dests = [
627+
path for path in state.keys()
628+
if path not in current_dests
629+
]
630+
631+
if removed_dests:
632+
raise StateMismatch(
633+
f"The following config files are tracked in state but missing "
634+
f"from config.json. "
635+
f"They would be restored or removed: {sorted(removed_dests)}"
636+
)
637+
638+
# Perform the regular content, permissions, and ownership
639+
# checks on the declared files
586640
for data in config.get('config_files', []):
587641
config_file = ConfigFile(**data)
588642
config_file.check()

docker/glance/glance-api/Dockerfile.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
99

1010
{% if base_package_type == 'rpm' %}
1111
{% set glance_api_packages = [
12+
'lsscsi',
1213
'device-mapper-multipath',
1314
'qemu-img'
1415
] %}
1516
{% elif base_package_type == 'deb' %}
1617
{% set glance_api_packages = [
18+
'lsscsi',
1719
'multipath-tools',
1820
'nfs-common',
1921
'qemu-utils'

docker/keystone/keystone/extend_start.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@ fi
4747

4848
. /usr/local/bin/kolla_httpd_setup
4949

50-
ARGS="-DFOREGROUND"

docker/prometheus/prometheus-ovn-exporter/Dockerfile.j2

Lines changed: 0 additions & 22 deletions
This file was deleted.

docker/rabbitmq/healthcheck_rabbitmq

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
set -e
44

5-
rabbitmq-diagnostics -t 5 -q ping || exit 1
6-
rabbitmq-diagnostics -t 5 -q status || exit 1
7-
rabbitmq-diagnostics -t 5 -q check_running || exit 1
8-
rabbitmq-diagnostics -t 5 -q check_local_alarms || exit 1
9-
rabbitmq-diagnostics -t 5 -q check_port_connectivity || exit 1
10-
rabbitmq-diagnostics -t 5 -q check_virtual_hosts || exit 1
5+
for check in ping status check_running check_local_alarms check_port_connectivity check_virtual_hosts; do
6+
echo "Running rabbitmq-diagnostics $check"
7+
rabbitmq-diagnostics -t 5 -q $check || (echo "ERROR: $check failed" && exit 1)
8+
done

kolla/common/sources.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,6 @@
383383
'releases/download/v${version}/'
384384
'openstack-exporter'
385385
'_${version}_linux_${debian_arch}.tar.gz')},
386-
'prometheus-ovn-exporter': {
387-
'version': '1.0.7',
388-
'type': 'url',
389-
'sha256': {
390-
'amd64': '38d9874ddca1581574a7fa0a28ea53447a57dada37bb1385adeb766e6e819de0', # noqa: E501
391-
'arm64': 'e03f6a5ab4cf2855a498697026981273ce3c9ff16bd9bb6c97fd7f1344ec2067'}, # noqa: E501
392-
'location': ('https://github.com/'
393-
'greenpau/ovn_exporter/'
394-
'releases/download/v${version}/'
395-
'ovn-exporter'
396-
'_${version}_linux_${debian_arch}.tar.gz')},
397386
'prometheus-server': {
398387
'version': '3.2.1',
399388
'type': 'url',
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes set_configs.py not detecting removed config files
5+
during --check, which prevented container restart when
6+
needed. `LP#2114173 <https://launchpad.net/bugs/2114173>`__
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fix using Cinder as Glance image store when Cinder uses a FC or iSCSI
5+
backend by adding the missing ``lsscsi`` package to glance-api.
6+
`LP#2111828 <https://bugs.launchpad.net/kolla/+bug/2111828>`__
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
deprecations:
3+
- |
4+
The OVN exporter has been removed with immediate effect since 1) it isn't
5+
used in Kolla Ansible and 2) the source repo was archived in Dec 2024.

tests/test_set_config.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,3 +892,47 @@ def test_handle_defaults_state_exist_config_restored(
892892

893893
# Verify that the updated state was saved
894894
mock_set_defaults_state.assert_called_once_with(expected_state)
895+
896+
897+
class ExecuteConfigCheckStateMismatchTest(base.BaseTestCase):
898+
899+
@mock.patch.object(set_configs, 'get_defaults_state')
900+
def test_execute_config_check_raises_state_mismatch(
901+
self, mock_get_defaults_state
902+
):
903+
"""Test execute_config_check() when state has extra config file.
904+
905+
This test simulates the scenario where the state file contains
906+
a destination that no longer exists in config.json. It verifies:
907+
- get_defaults_state() returns a state with an extra entry.
908+
- execute_config_check() raises StateMismatch when config.json
909+
omits a tracked destination.
910+
"""
911+
config = {
912+
"command": "/bin/true",
913+
"config_files": [
914+
{
915+
"source": "/etc/foo/foo.conf",
916+
"dest": "/etc/foo/foo.conf",
917+
"owner": "user1",
918+
"perm": "0644"
919+
}
920+
]
921+
}
922+
923+
mock_get_defaults_state.return_value = {
924+
"/etc/foo/foo.conf": {
925+
"source": "/etc/foo/foo.conf",
926+
"preserve_properties": True,
927+
"dest": "/etc/kolla/defaults/etc/foo/foo.conf"
928+
},
929+
"/etc/old/obsolete.conf": {
930+
"source": "/etc/old/obsolete.conf",
931+
"preserve_properties": True,
932+
"dest": "/etc/kolla/defaults/etc/old/obsolete.conf"
933+
}
934+
}
935+
936+
self.assertRaises(set_configs.StateMismatch,
937+
set_configs.execute_config_check,
938+
config)

0 commit comments

Comments
 (0)