diff --git a/manifests/backend/glusternative.pp b/manifests/backend/glusternative.pp index 1650f22e..aeaacfab 100644 --- a/manifests/backend/glusternative.pp +++ b/manifests/backend/glusternative.pp @@ -13,7 +13,7 @@ # Each GlusterFS server should be of the form [remoteuser@], and # they are assumed to belong to distinct Gluster clusters. # -# [*glusterfs_native_path_to_private_key*] +# [*glusterfs_path_to_private_key*] # (required) Path of Manila host's private SSH key file. # # [*glusterfs_volume_pattern*] @@ -23,12 +23,21 @@ # [*package_ensure*] # (optional) Ensure state for package. Defaults to 'present'. # +# DEPRECATED PARAMETERS +# +# [*glusterfs_native_path_to_private_key*] +# (optional) Path of Manila host's private SSH key file. This parameter has +# been replaced by glusterfs_path_to_private_key. Compatibility will be +# removed in a future release. +# define manila::backend::glusternative ( $glusterfs_servers, - $glusterfs_native_path_to_private_key, $glusterfs_volume_pattern, - $share_backend_name = $name, - $package_ensure = 'present', + $share_backend_name = $name, + $package_ensure = 'present', + $glusterfs_path_to_private_key = undef, + # DEPRECATED PARAMETERS + $glusterfs_native_path_to_private_key = undef, ) { include manila::deps @@ -36,12 +45,18 @@ define manila::backend::glusternative ( $share_driver = 'manila.share.drivers.glusterfs_native.GlusterfsNativeShareDriver' + if $glusterfs_native_path_to_private_key { + warning('The glusterfs_native_path_to_private_key parameter is deprecated, use glusterfs_path_to_private_key instead') + } + + $glusterfs_path_to_private_key_real = pick($glusterfs_path_to_private_key, $glusterfs_native_path_to_private_key) + manila_config { - "${share_backend_name}/share_backend_name": value => $share_backend_name; - "${share_backend_name}/share_driver": value => $share_driver; - "${share_backend_name}/glusterfs_servers": value => $glusterfs_servers; - "${share_backend_name}/glusterfs_native_path_to_private_key": value => $glusterfs_native_path_to_private_key; - "${share_backend_name}/glusterfs_volume_pattern": value => $glusterfs_volume_pattern; + "${share_backend_name}/share_backend_name": value => $share_backend_name; + "${share_backend_name}/share_driver": value => $share_driver; + "${share_backend_name}/glusterfs_servers": value => $glusterfs_servers; + "${share_backend_name}/glusterfs_path_to_private_key": value => $glusterfs_path_to_private_key_real; + "${share_backend_name}/glusterfs_volume_pattern": value => $glusterfs_volume_pattern; } package { $::manila::params::gluster_package_name: diff --git a/releasenotes/notes/cleanup-glusterfs-native-deprecation-77a26e6b98b74147.yaml b/releasenotes/notes/cleanup-glusterfs-native-deprecation-77a26e6b98b74147.yaml new file mode 100644 index 00000000..e813e130 --- /dev/null +++ b/releasenotes/notes/cleanup-glusterfs-native-deprecation-77a26e6b98b74147.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - | + The parameter 'manila::backend::glusternative::glusterfs_native_path_to_private_key' + has been deprecated and replaced with + 'manila::backend::glusternative::glusterfs_path_to_private_key'. The + older option will be removed in a future release. diff --git a/spec/defines/manila_backend_glusternative_spec.rb b/spec/defines/manila_backend_glusternative_spec.rb index e7c31db7..ac3bd109 100644 --- a/spec/defines/manila_backend_glusternative_spec.rb +++ b/spec/defines/manila_backend_glusternative_spec.rb @@ -8,7 +8,7 @@ describe 'manila::backend::glusternative' do let :params do { :glusterfs_servers => 'remoteuser@volserver', - :glusterfs_native_path_to_private_key => '/etc/glusterfs/glusterfs.pem', + :glusterfs_path_to_private_key => '/etc/glusterfs/glusterfs.pem', :glusterfs_volume_pattern => 'manila-share-volume-\d+$', } end @@ -24,6 +24,30 @@ describe 'manila::backend::glusternative' do end end end + + + context 'with deprecated parameters' do + let :params do + { + :glusterfs_servers => 'remoteuser@volserver', + :glusterfs_native_path_to_private_key => '/etc/glusterfs/glusterfs.pem', + :glusterfs_volume_pattern => 'manila-share-volume-\d+$', + } + end + + it 'configures glusternative share driver with deprecated parameters' do + is_expected.to contain_manila_config('fuse/share_backend_name').with( + :value => 'fuse') + is_expected.to contain_manila_config('fuse/share_driver').with_value( + 'manila.share.drivers.glusterfs_native.GlusterfsNativeShareDriver') + is_expected.to contain_manila_config('fuse/glusterfs_servers').with_value( + 'remoteuser@volserver') + is_expected.to contain_manila_config('fuse/glusterfs_path_to_private_key').with_value( + '/etc/glusterfs/glusterfs.pem') + is_expected.to contain_manila_config('fuse/glusterfs_volume_pattern').with_value( + 'manila-share-volume-\d+$') + end + end end on_supported_os({ @@ -37,4 +61,5 @@ describe 'manila::backend::glusternative' do it_behaves_like 'glusternative volume driver' end end + end