diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index c779841b..ddbd58b6 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -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'], diff --git a/spec/type_aliases/cephconf_spec.rb b/spec/type_aliases/cephconf_spec.rb new file mode 100644 index 00000000..80b0b38b --- /dev/null +++ b/spec/type_aliases/cephconf_spec.rb @@ -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', + '', + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end +end diff --git a/types/cephconf.pp b/types/cephconf.pp new file mode 100644 index 00000000..77a7de7a --- /dev/null +++ b/types/cephconf.pp @@ -0,0 +1 @@ +type Cinder::CephConf = Pattern[/^\/([^\n\/\0]+\/*)*[^\n\/\0]+\.conf$/]