Merge "rbd: More strictly validate rbd_ceph_conf"

This commit is contained in:
Zuul 2024-04-01 23:19:12 +00:00 committed by Gerrit Code Review
commit f81f6ad1d8
3 changed files with 37 additions and 1 deletions

View File

@ -121,7 +121,7 @@ define cinder::backend::rbd (
$backend_availability_zone = $facts['os_service_default'],
$reserved_percentage = $facts['os_service_default'],
$max_over_subscription_ratio = $facts['os_service_default'],
$rbd_ceph_conf = '/etc/ceph/ceph.conf',
Cinder::CephConf $rbd_ceph_conf = '/etc/ceph/ceph.conf',
$rbd_flatten_volume_from_snapshot = $facts['os_service_default'],
$rbd_secret_uuid = $facts['os_service_default'],
$rbd_max_clone_depth = $facts['os_service_default'],

View File

@ -0,0 +1,35 @@
require 'spec_helper'
describe 'Cinder::CephConf' do
describe 'valid types' do
context 'with valid types' do
[
'/etc/ceph/ceph.conf',
'/etc/ceph.conf',
'/ceph.conf',
'/etc/ceph/foo/ceph.conf',
'/etc/ceph/foo.conf',
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end
end
describe 'invalid types' do
context 'with garbage inputs' do
[
'etc/ceph/ceph.conf',
'ceph.conf',
'/etc/ceph/ceph.config',
'/etc/ceph/ceph',
'<SERVICE DEFAULT>',
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
end

1
types/cephconf.pp Normal file
View File

@ -0,0 +1 @@
type Cinder::CephConf = Pattern[/^\/([^\n\/\0]+\/*)*[^\n\/\0]+\.conf$/]