rbd: More strictly validate rbd_ceph_conf
The rbd_ceph_conf parameter accepts a valid path for *.conf file, because of the internal logic to detect the cluster name. Change-Id: Ia42f5db1ff701b5ba90dbdb7e80c7b906b406222
This commit is contained in:
		@@ -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'],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								spec/type_aliases/cephconf_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								spec/type_aliases/cephconf_spec.rb
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										1
									
								
								types/cephconf.pp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
type Cinder::CephConf = Pattern[/^\/([^\n\/\0]+\/*)*[^\n\/\0]+\.conf$/]
 | 
			
		||||
		Reference in New Issue
	
	Block a user