Add support for [image_format] require_image_format_match

... which was added during this cycle.

Depends-on: https://review.opendev.org/930492
Change-Id: I9e6c3f5714a4b83e9d80bde1724afba0758e5aad
This commit is contained in:
Takashi Kajinami
2025-02-25 09:49:58 +09:00
parent a1a95cceb4
commit 0b4cb4893a
3 changed files with 27 additions and 3 deletions

View File

@@ -62,6 +62,11 @@
# (optional) List of allowed values for an image disk_format attribute.
# Defaults to $facts['os_service_default'].
#
# [*require_image_format_match*]
# (optional) Inspect the content of uploads and require that they match
# the disk format set on the image.
# Defaults to $facts['os_service_default'].
#
# [*image_cache_driver*]
# (optional) The driver to use for image cache management.
# Defaults to $facts['os_service_default'].
@@ -287,6 +292,7 @@ class glance::api(
$default_backend = undef,
$container_formats = $facts['os_service_default'],
$disk_formats = $facts['os_service_default'],
$require_image_format_match = $facts['os_service_default'],
$image_cache_driver = $facts['os_service_default'],
$image_cache_dir = '/var/lib/glance/image-cache',
$image_cache_max_size = $facts['os_service_default'],
@@ -517,8 +523,9 @@ enabled_backends instead.')
}
glance_api_config {
'image_format/container_formats': value => join(any2array($container_formats), ',');
'image_format/disk_formats': value => join(any2array($disk_formats), ',');
'image_format/container_formats': value => join(any2array($container_formats), ',');
'image_format/disk_formats': value => join(any2array($disk_formats), ',');
'image_format/require_image_format_match': value => $require_image_format_match;
}
resources { 'glance_api_config':

View File

@@ -0,0 +1,5 @@
---
features:
- |
The new ``glance::api::require_image_format_match`` parameter has been
added.

View File

@@ -41,7 +41,6 @@ describe 'glance::api' do
:image_location_quota => '<SERVICE DEFAULT>',
:image_size_cap => '<SERVICE DEFAULT>',
:user_storage_quota => '<SERVICE DEFAULT>',
:disk_formats => '<SERVICE DEFAULT>',
:paste_deploy_flavor => 'keystone',
:paste_deploy_config_file => '<SERVICE DEFAULT>',
:task_time_to_live => '<SERVICE DEFAULT>',
@@ -215,6 +214,7 @@ describe 'glance::api' do
it 'is_expected.to have no formats set' do
is_expected.to contain_glance_api_config('image_format/container_formats').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('image_format/disk_formats').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('image_format/require_image_format_match').with_value('<SERVICE DEFAULT>')
end
it 'passes purge to resource' do
@@ -360,6 +360,18 @@ describe 'glance::api' do
end
end
describe 'with require_image_format_match' do
let :params do
{
:require_image_format_match => true,
}
end
context 'with require_image_format_match option' do
it { is_expected.to contain_glance_api_config('image_format/require_image_format_match').with_value(true) }
end
end
describe 'with enabled_backends and stores by default' do
it { is_expected.to_not contain_glance_api_config('DEFAULT/enabled_backends').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('<SERVICE DEFAULT>') }