Partially fix undefined variables

This is the first step to get rid of the errors found in unit tests
with Puppet 8, and fixes some undefined variables found in ceph::osd.
This also fixes a few redundant spaces appearing in commands.

Change-Id: I52b26701e77af44e8fb80106a6d1b6dbd34f133d
This commit is contained in:
Takashi Kajinami 2023-07-17 22:34:13 +09:00
parent f09989828a
commit 8bc67e20e7
2 changed files with 17 additions and 11 deletions

View File

@ -92,7 +92,7 @@ define ceph::osd (
$cluster_option = "--cluster ${cluster_name}"
if $store_type {
$osd_type = "--${store_type}"
$osd_type = " --${store_type}"
} else {
$osd_type = ''
}
@ -100,14 +100,18 @@ define ceph::osd (
if ($bluestore_wal) or ($bluestore_db) {
if $bluestore_wal {
$wal_opts = "--block.wal ${bluestore_wal}"
} else {
$wal_opts = undef
}
if $bluestore_db {
$block_opts = "--block.db ${bluestore_db}"
} else {
$block_opts = undef
}
$journal_opts = "${wal_opts} ${block_opts}"
$journal_opts = join(delete_undef_values(['', $wal_opts, $block_opts]), ' ')
} elsif $journal {
$journal_opts = "--journal ${journal}"
$journal_opts = " --journal ${journal}"
} else {
$journal_opts = ''
}
@ -131,7 +135,7 @@ define ceph::osd (
Exec<| tag == 'prepare' |> -> Exec<| tag == 'activate' |>
if $fsid {
$fsid_option = "--cluster-fsid ${fsid}"
$fsid_option = " --cluster-fsid ${fsid}"
$ceph_check_fsid_mismatch = "ceph-osd-check-fsid-mismatch-${name}"
Exec[$ceph_check_fsid_mismatch] -> Exec[$ceph_prepare]
# return error if $(readlink -f ${data}) has fsid differing from ${fsid}, unless there is no fsid
@ -150,6 +154,8 @@ test ${fsid} = $(ceph-volume lvm list ${data} |grep 'cluster fsid' | awk -F'fsid
logoutput => true,
timeout => $exec_timeout,
}
} else {
$fsid_option = ''
}
#name of the bootstrap osd keyring
@ -176,7 +182,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 ${osd_type} ${cluster_option}${dmcrypt_options} ${fsid_option} --data ${data} ${journal_opts}
ceph-volume lvm prepare${osd_type} ${cluster_option}${dmcrypt_options}${fsid_option} --data ${data}${journal_opts}
",
unless => "/bin/true # comment to satisfy puppet syntax requirements
set -ex

View File

@ -40,7 +40,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 --cluster ceph --data vg_test/lv_test
ceph-volume lvm prepare --cluster ceph --data vg_test/lv_test
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
@ -178,7 +178,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 --cluster ceph --dmcrypt --dmcrypt-key-dir '/etc/ceph/dmcrypt-keys' --data /dev/sdc
ceph-volume lvm prepare --cluster ceph --dmcrypt --dmcrypt-key-dir '/etc/ceph/dmcrypt-keys' --data /dev/sdc
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
@ -239,7 +239,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 --cluster ceph --dmcrypt --dmcrypt-key-dir '/srv/ceph/keys' --data /dev/sdc
ceph-volume lvm prepare --cluster ceph --dmcrypt --dmcrypt-key-dir '/srv/ceph/keys' --data /dev/sdc
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
@ -369,7 +369,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 --cluster ceph --data /dev/nvme0n1
ceph-volume lvm prepare --cluster ceph --data /dev/nvme0n1
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
@ -423,7 +423,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 --cluster ceph --data /dev/cciss/c0d0
ceph-volume lvm prepare --cluster ceph --data /dev/cciss/c0d0
",
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex