Merge "Fix deprecated glusterfs option"

This commit is contained in:
Zuul 2020-08-13 00:41:08 +00:00 committed by Gerrit Code Review
commit 0eea540b6b
3 changed files with 57 additions and 10 deletions

View File

@ -13,7 +13,7 @@
# Each GlusterFS server should be of the form [remoteuser@]<volserver>, and # Each GlusterFS server should be of the form [remoteuser@]<volserver>, and
# they are assumed to belong to distinct Gluster clusters. # 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. # (required) Path of Manila host's private SSH key file.
# #
# [*glusterfs_volume_pattern*] # [*glusterfs_volume_pattern*]
@ -23,12 +23,21 @@
# [*package_ensure*] # [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'. # (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 ( define manila::backend::glusternative (
$glusterfs_servers, $glusterfs_servers,
$glusterfs_native_path_to_private_key,
$glusterfs_volume_pattern, $glusterfs_volume_pattern,
$share_backend_name = $name, $share_backend_name = $name,
$package_ensure = 'present', $package_ensure = 'present',
$glusterfs_path_to_private_key = undef,
# DEPRECATED PARAMETERS
$glusterfs_native_path_to_private_key = undef,
) { ) {
include manila::deps include manila::deps
@ -36,12 +45,18 @@ define manila::backend::glusternative (
$share_driver = 'manila.share.drivers.glusterfs_native.GlusterfsNativeShareDriver' $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 { manila_config {
"${share_backend_name}/share_backend_name": value => $share_backend_name; "${share_backend_name}/share_backend_name": value => $share_backend_name;
"${share_backend_name}/share_driver": value => $share_driver; "${share_backend_name}/share_driver": value => $share_driver;
"${share_backend_name}/glusterfs_servers": value => $glusterfs_servers; "${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_path_to_private_key": value => $glusterfs_path_to_private_key_real;
"${share_backend_name}/glusterfs_volume_pattern": value => $glusterfs_volume_pattern; "${share_backend_name}/glusterfs_volume_pattern": value => $glusterfs_volume_pattern;
} }
package { $::manila::params::gluster_package_name: package { $::manila::params::gluster_package_name:

View File

@ -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.

View File

@ -8,7 +8,7 @@ describe 'manila::backend::glusternative' do
let :params do let :params do
{ {
:glusterfs_servers => 'remoteuser@volserver', :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+$', :glusterfs_volume_pattern => 'manila-share-volume-\d+$',
} }
end end
@ -24,6 +24,30 @@ describe 'manila::backend::glusternative' do
end end
end 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 end
on_supported_os({ on_supported_os({
@ -37,4 +61,5 @@ describe 'manila::backend::glusternative' do
it_behaves_like 'glusternative volume driver' it_behaves_like 'glusternative volume driver'
end end
end end
end end