Thomas Goirand f89f95eff8 Fix test isolation of cachedir in TestCollectAll
TestCollectAll.setUp() copies the global cfg.CONF object with
copy.copy() and restores it during cleanup. With oslo.config >= 10.7.0
on Python 3.14 this no longer isolates the tests: a stale cachedir
value (a fixtures.TempDir path) leaks into subsequent tests, making
TestConf.test_setup_conf fail, and sometimes
TestEc2.test_collect_ec2_collected too.

Replace the copy/restore hack with the standard oslo.config test
isolation pattern already used by the other test modules: register
self.addCleanup(cfg.CONF.reset) and set cachedir/backup_cachedir with
cfg.CONF.set_override().

Found in the Debian rebuild on forky/sid (oslo.config 10.7.0, Python
3.14): https://bugs.debian.org/1149108

Closes-Bug: #2168664
Change-Id: Ibcc09cbb50a843a8e5e6c1f0beb7f1f26a3b2254
Signed-off-by: Thomas Goirand <zigo@debian.org>
2026-09-27 15:42:51 +02:00
2023-10-18 15:00:13 +09:00
2023-12-19 21:02:44 +09:00
2019-04-19 19:42:57 +00:00
2018-07-10 18:53:52 +07:00
2025-11-21 22:15:21 +09:00
2025-07-26 14:25:07 +09:00
2023-11-28 00:23:17 +09:00
2026-05-05 02:57:48 +09:00

os-collect-config

image

Collect configuration from cloud metadata sources

What does it do?

It collects data from defined configuration sources and runs a defined hook whenever the metadata has been changed.

image

1

Usage

You must define what sources to collect configuration data from in /etc/os-collect-config.conf.

The format of this file is:

[DEFAULT]
command=os-refresh-config

[cfn]
metadata_url=http://192.0.2.99:8000/v1/
access_key_id = ABCDEFGHIJLMNOP01234567890
secret_access_key = 01234567890ABCDEFGHIJKLMNOP
path = MyResource
stack_name = my.stack

These sources will be polled and whenever any of them is changed, default.command will be run. A file will be written to the cache dir, os_config_files.json, which will be a json list of the file paths to the current copy of each metadata source. This list will also be set as a colon separated list in the environment variable OS_CONFIG_FILES for the command that is run. So in the example above, os-refresh-config would be executed with something like this in OS_CONFIG_FILES:

/var/lib/os-collect-config/ec2.json:/var/lib/os-collect-config/cfn.json

The previous version of the metadata from a source (if available) is present at $FILENAME.last.

When run without a command, the metadata sources are printed as a json document.

Quick Start

Install:

sudo pip install -U git+https://opendev.org/openstack/os-collect-config.git

Run it on an OpenStack instance with access to ec2 metadata:

os-collect-config

That should print out a json representation of the entire ec2 metadata tree.


  1. Recommend using LibreOffice draw to edit os-collect-config-and-friends.odg and regenerate the svg file. Alternatively edit the svg directly, but remove the .odg file if that is done.↩︎

S
Description
Collect and cache metadata, run hooks on changes.
Readme
3.3 MiB
2 Watchers 0 Forks
Languages
Python 100%