Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/contributor/versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ information about package sources.
.. _`Team RabbitMQ 'Cloudsmith' repo (Deb)`: https://www.rabbitmq.com/install-debian.html#apt-cloudsmith
.. _`Team RabbitMQ 'Modern Erlang' PPA`: https://launchpad.net/~rabbitmq/+archive/ubuntu/rabbitmq-erlang
.. _`Team RabbitMQ 'Cloudsmith' repo (RPM)`: https://www.rabbitmq.com/docs/install-rpm#cloudsmith
.. _`openstack-kolla COPR`: https://copr.fedorainfracloud.org/coprs/g/openstack-kolla/rabbitmq-erlang/
.. _`openstack-kolla COPR`: https://copr.fedorainfracloud.org/coprs/g/openstack-kolla/rabbitmq-erlang-26/

.. _`Grafana install guide`: https://grafana.com/grafana/download?platform=linux&edition=oss
.. _`MariaDB Community downloads`: https://mariadb.com/downloads/community/
3 changes: 2 additions & 1 deletion docker/base/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ COPY dnf.conf /etc/dnf/dnf.conf

{% elif base_arch == 'aarch64' %}
{% set base_yum_repo_files = base_yum_repo_files + [
'copr-rabbitmq-erlang.repo',
'copr-rabbitmq-erlang-26.repo',
'copr-rabbitmq-erlang-27.repo',
] %}

{#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# from https://github.com/rabbitmq/erlang-rpm/
# Thanks to COPR we have aarch64 packages for Rocky Linux

[copr-rabbitmq-erlang]
name=openstack-kolla COPR with Erlang build for RabbitMQ
baseurl=https://download.copr.fedorainfracloud.org/results/@openstack-kolla/rabbitmq-erlang/rhel-$releasever-aarch64/
[copr-rabbitmq-erlang-26]
name=openstack-kolla COPR with Erlang 26 build for RabbitMQ
baseurl=https://download.copr.fedorainfracloud.org/results/@openstack-kolla/rabbitmq-erlang-26/rhel-$releasever-aarch64/
gpgcheck=1
enabled=0
gpgkey=https://download.copr.fedorainfracloud.org/results/@openstack-kolla/rabbitmq-erlang/pubkey.gpg
gpgkey=https://download.copr.fedorainfracloud.org/results/@openstack-kolla/rabbitmq-erlang-26/pubkey.gpg
repo_gpgcheck=0
11 changes: 11 additions & 0 deletions docker/base/copr-rabbitmq-erlang-27.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# NOTE(hrw): this repository contains rebuild of Erlang package from RabbitMQ team
# from https://github.com/rabbitmq/erlang-rpm/
# Thanks to COPR we have aarch64 packages for Rocky Linux

[copr-rabbitmq-erlang-27]
name=openstack-kolla COPR with Erlang 27 build for RabbitMQ
baseurl=https://download.copr.fedorainfracloud.org/results/@openstack-kolla/rabbitmq-erlang-27/rhel-$releasever-aarch64/
gpgcheck=1
enabled=0
gpgkey=https://download.copr.fedorainfracloud.org/results/@openstack-kolla/rabbitmq-erlang-27/pubkey.gpg
repo_gpgcheck=0
2 changes: 1 addition & 1 deletion docker/base/mariadb.repo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[mariadb]
name = MariaDB Server
baseurl = https://dlm.mariadb.com/repo/mariadb-server/10.11.11/yum/rhel/$releasever/$basearch
baseurl = https://dlm.mariadb.com/repo/mariadb-server/10.11/yum/rhel/$releasever/$basearch
gpgcheck = 1
enabled = 0
module_hotfixes = 1
Expand Down
54 changes: 54 additions & 0 deletions docker/base/set_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class ConfigFileCommandDiffers(ExitingException):
pass


class StateMismatch(ExitingException):
pass


class ConfigFile(object):

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


def execute_config_check(config):
"""Check configuration state consistency and validate config file entries.

This function compares the current config file destinations from the
provided config dictionary with those stored in the defaults state file.
If any destinations are found in the state file but not in the config,
a StateMismatch exception is raised. These missing files would otherwise
be restored or removed depending on their backup state.

After validating consistency, the function performs standard checks on
each declared configuration file, including content, permissions, and
ownership validation.

Args:
config (dict): The configuration dictionary containing 'config_files'
entries as expected by Kolla.

Raises:
StateMismatch: If there are entries in the defaults state not present
in the provided config.
"""
state = get_defaults_state()

# Build a set of all current destination paths from config.json
# If the destination is a directory, we append the
# basename of the source
current_dests = {
entry['dest'] if not entry['dest'].endswith('/') else
os.path.join(entry['dest'], os.path.basename(entry['source']))
for entry in config.get('config_files', [])
if entry.get('dest')
}

# Detect any paths that are present in the state file but
# missing from config.json.
# These would be either restored (if state[dest] has a backup)
# or removed (if dest is null)
removed_dests = [
path for path in state.keys()
if path not in current_dests
]

if removed_dests:
raise StateMismatch(
f"The following config files are tracked in state but missing "
f"from config.json. "
f"They would be restored or removed: {sorted(removed_dests)}"
)

# Perform the regular content, permissions, and ownership
# checks on the declared files
for data in config.get('config_files', []):
config_file = ConfigFile(**data)
config_file.check()
Expand Down
22 changes: 12 additions & 10 deletions kolla/template/repos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ centos-aarch64:
crb: "crb"
docker-ce: "docker-ce"
epel: "epel"
erlang: "copr-rabbitmq-erlang"
erlang-26: "copr-rabbitmq-erlang-26"
erlang-27: "copr-rabbitmq-erlang-27"
extras: "extras"
fluentd: "fluent-package-lts"
grafana: "grafana"
Expand Down Expand Up @@ -72,7 +73,7 @@ debian:
component: "stable"
gpg_key: "influxdb.asc"
mariadb:
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11.11/repo/debian"
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/debian"
suite: "bookworm"
component: "main"
gpg_key: "mariadb.gpg"
Expand Down Expand Up @@ -129,7 +130,7 @@ debian-aarch64:
component: "stable"
gpg_key: "influxdb.asc"
mariadb:
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11.11/repo/debian"
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/debian"
suite: "bookworm"
component: "main"
gpg_key: "mariadb.gpg"
Expand Down Expand Up @@ -181,7 +182,8 @@ rocky-aarch64:
crb: "crb"
docker-ce: "docker-ce"
epel: "epel"
erlang: "copr-rabbitmq-erlang"
erlang-26: "copr-rabbitmq-erlang-26"
erlang-27: "copr-rabbitmq-erlang-27"
extras: "extras"
fluentd: "fluent-package-lts"
grafana: "grafana"
Expand All @@ -203,12 +205,12 @@ ubuntu:
gpg_key: "docker-ce.asc"
erlang-26:
url: "https://ppa.launchpadcontent.net/rabbitmq/rabbitmq-erlang-26/ubuntu"
suite: "jammy"
suite: "noble"
component: "main"
gpg_key: "erlang-ppa.gpg"
erlang-27:
url: "https://ppa.launchpadcontent.net/rabbitmq/rabbitmq-erlang-27/ubuntu"
suite: "jammy"
suite: "noble"
component: "main"
gpg_key: "erlang-ppa.gpg"
fluentd:
Expand All @@ -228,7 +230,7 @@ ubuntu:
component: "stable"
gpg_key: "influxdb.asc"
mariadb:
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11.11/repo/ubuntu"
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/ubuntu"
suite: "noble"
component: "main"
gpg_key: "mariadb.gpg"
Expand Down Expand Up @@ -261,12 +263,12 @@ ubuntu-aarch64:
gpg_key: "docker-ce.asc"
erlang-26:
url: "https://ppa.launchpadcontent.net/rabbitmq/rabbitmq-erlang-26/ubuntu"
suite: "jammy"
suite: "noble"
component: "main"
gpg_key: "erlang-ppa.gpg"
erlang-27:
url: "https://ppa.launchpadcontent.net/rabbitmq/rabbitmq-erlang-27/ubuntu"
suite: "jammy"
suite: "noble"
component: "main"
gpg_key: "erlang-ppa.gpg"
fluentd:
Expand All @@ -286,7 +288,7 @@ ubuntu-aarch64:
component: "stable"
gpg_key: "influxdb.asc"
mariadb:
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11.11/repo/ubuntu"
url: "https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/ubuntu"
suite: "noble"
component: "main"
gpg_key: "mariadb.gpg"
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/bug-2114173-70d0b815a42ae239.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fixes set_configs.py not detecting removed config files
during --check, which prevented container restart when
needed. `LP#2114173 <https://launchpad.net/bugs/2114173>`__
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
upgrade:
- |
Switches Erlang RPMs on aarch64 to a versioned Erlang 26 or 27 repository,
due to Fedora COPR not supporting multiple package versions in one repo.
44 changes: 44 additions & 0 deletions tests/test_set_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,3 +875,47 @@ def test_handle_defaults_state_exist_config_restored(

# Verify that the updated state was saved
mock_set_defaults_state.assert_called_once_with(expected_state)


class ExecuteConfigCheckStateMismatchTest(base.BaseTestCase):

@mock.patch.object(set_configs, 'get_defaults_state')
def test_execute_config_check_raises_state_mismatch(
self, mock_get_defaults_state
):
"""Test execute_config_check() when state has extra config file.

This test simulates the scenario where the state file contains
a destination that no longer exists in config.json. It verifies:
- get_defaults_state() returns a state with an extra entry.
- execute_config_check() raises StateMismatch when config.json
omits a tracked destination.
"""
config = {
"command": "/bin/true",
"config_files": [
{
"source": "/etc/foo/foo.conf",
"dest": "/etc/foo/foo.conf",
"owner": "user1",
"perm": "0644"
}
]
}

mock_get_defaults_state.return_value = {
"/etc/foo/foo.conf": {
"source": "/etc/foo/foo.conf",
"preserve_properties": True,
"dest": "/etc/kolla/defaults/etc/foo/foo.conf"
},
"/etc/old/obsolete.conf": {
"source": "/etc/old/obsolete.conf",
"preserve_properties": True,
"dest": "/etc/kolla/defaults/etc/old/obsolete.conf"
}
}

self.assertRaises(set_configs.StateMismatch,
set_configs.execute_config_check,
config)