Fix unknown variable errors caused by ceph::profile::fsid

Thsi fixes the unknown variable errors caused by usage of
ceph::profile::fsid. The definition in ceph::profile should NOT be used
by generic implementation outside of profile modules.

Change-Id: I3bdb153f917838e309288b80a18af4a494d13a4d
This commit is contained in:
Takashi Kajinami 2023-07-21 14:35:28 +09:00
parent 50f777cbff
commit df03ad0501
4 changed files with 16 additions and 21 deletions

View File

@ -58,7 +58,7 @@
# Optional. Defaults to 'ceph_var_lib_t'
#
# [*fsid*] The ceph cluster FSID
# Optional. Defaults to $ceph::profile::params::fsid
# Optional. Defaults to undef,
#
# [*dmcrypt*] Encrypt [data-path] and/or journal devices with dm-crypt.
# Optional. Defaults to false.
@ -75,7 +75,7 @@ define ceph::osd (
Optional[Enum['filestore', 'bluestore']] $store_type = undef,
$exec_timeout = undef,
$selinux_file_context = 'ceph_var_lib_t',
$fsid = $ceph::profile::params::fsid,
$fsid = undef,
Boolean $dmcrypt = false,
$dmcrypt_key_dir = '/etc/ceph/dmcrypt-keys',
) {

View File

@ -23,7 +23,14 @@
class ceph::profile::osd {
require ceph::profile::client
if $ceph::profile::params::fsid {
$osd_defaults = {'fsid' => $ceph::profile::params::fsid}
} else {
$osd_defaults = {}
}
class { 'ceph::osds':
args => $ceph::profile::params::osds,
args => $ceph::profile::params::osds,
defaults => $osd_defaults,
}
}

View File

@ -31,6 +31,7 @@ describe 'ceph::osds' do
},
:defaults => {
'cluster' => 'CLUSTER',
'fsid' => 'f39ace04-f967-4c3d-9fd2-32af2d2d2cd5',
},
}
end
@ -39,10 +40,12 @@ describe 'ceph::osds' do
should contain_ceph__osd('/dev/sdb').with(
:ensure => 'present',
:journal => '/srv/journal',
:cluster => 'CLUSTER')
:cluster => 'CLUSTER',
:fsid => 'f39ace04-f967-4c3d-9fd2-32af2d2d2cd5')
should contain_ceph__osd('/srv/data').with(
:ensure => 'present',
:cluster => 'CLUSTER')
:cluster => 'CLUSTER',
:fsid => 'f39ace04-f967-4c3d-9fd2-32af2d2d2cd5')
}
end

View File

@ -83,27 +83,12 @@ ps -fCceph-osd|grep \"\\--id \$id \"
{
:cluster => 'testcluster',
:journal => '/srv/journal',
:fsid => 'f39ace04-f967-4c3d-9fd2-32af2d2d2cd5',
:store_type => 'bluestore',
:bluestore_wal => 'vg_test/lv_wal',
:bluestore_db => 'vg_test/lv_db',
}
end
it { should contain_exec('ceph-osd-check-fsid-mismatch-vg_test/lv_test').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
exit 1
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
if [ -z $(ceph-volume lvm list vg_test/lv_test |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ') ]; then
exit 0
fi
test f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 = $(ceph-volume lvm list vg_test/lv_test |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ')
",
'logoutput' => true
) }
it { should contain_exec('ceph-osd-prepare-vg_test/lv_test').with(
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
@ -118,7 +103,7 @@ if ! test -b \$disk ; then
# Since nautilus, only block devices or lvm logical volumes can be used for OSDs
exit 1
fi
ceph-volume lvm prepare --bluestore --cluster testcluster --cluster-fsid f39ace04-f967-4c3d-9fd2-32af2d2d2cd5 --data vg_test/lv_test --block.wal vg_test/lv_wal --block.db vg_test/lv_db
ceph-volume lvm prepare --bluestore --cluster testcluster --data vg_test/lv_test --block.wal vg_test/lv_wal --block.db vg_test/lv_db
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex