Add common implementation to manage [os_brick] options

The os-brick library now supports its own lock_path configuration. This
adds the defined resource type to manage the option so that we can
reuse this implementation in some modules.

Depends-on: https://review.opendev.org/c/openstack/os-brick/+/849324
Change-Id: Iae1c155692fec845a8cab0ae284eeeaaf3336962
This commit is contained in:
Takashi Kajinami 2022-11-27 01:52:34 +09:00
parent 7040315eca
commit 7e187f637a
3 changed files with 64 additions and 0 deletions

19
manifests/os_brick.pp Normal file
View File

@ -0,0 +1,19 @@
# == Define: oslo::os_brick
#
# Configure os_brick options
#
# === Parameters:
#
# [*lock_path*]
# (Optional) Directory to use for os-brick lock files.
# Defaults to $::os_service_default
#
define oslo::os_brick(
$lock_path = $::os_service_default,
) {
$os_brick_options = {
'os_brick/lock_path' => { value => $lock_path },
}
create_resources($name, $os_brick_options)
}

View File

@ -0,0 +1,6 @@
---
features:
- |
The new ``oslo::os_brick`` defined resource type has been added. This can
be used to manage the ``[os_brick]`` options provided by the ``os-brick``
library.

View File

@ -0,0 +1,39 @@
require 'spec_helper'
describe 'oslo::os_brick' do
let (:title) { 'keystone_config' }
shared_examples 'oslo::os_brick' do
context 'with defaults' do
it 'configures the default values' do
is_expected.to contain_keystone_config('os_brick/lock_path').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters overridden' do
let :params do
{
:lock_path => '/var/lib/openstack/lock'
}
end
it 'configures the overridden values' do
is_expected.to contain_keystone_config('os_brick/lock_path').with_value('/var/lib/openstack/lock')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
include_examples 'oslo::os_brick'
end
end
end