Update to reduce puppet errors.
This patch reduces the amount of warnings due to 'unknown variables' with certian combinations of class arguments. mon_caps, osd_caps and mds_caps are set to '' if no relevant options are passed. cluster_option is set to '--cluster ceph' if no custom cluster name is passed to the relevant classes. Change-Id: I3204b402c00dab4836c8a3ea64eb769a83f7b51f
This commit is contained in:
@@ -87,17 +87,27 @@ define ceph::key (
|
||||
|
||||
if $cluster {
|
||||
$cluster_option = "--cluster ${cluster}"
|
||||
} else
|
||||
{
|
||||
$cluster_option = ''
|
||||
}
|
||||
|
||||
if $cap_mon {
|
||||
$mon_caps = "--cap mon '${cap_mon}' "
|
||||
} else {
|
||||
$mon_caps = ''
|
||||
}
|
||||
if $cap_osd {
|
||||
$osd_caps = "--cap osd '${cap_osd}' "
|
||||
} else {
|
||||
$osd_caps = ''
|
||||
}
|
||||
if $cap_mds {
|
||||
$mds_caps = "--cap mds '${cap_mds}' "
|
||||
} else {
|
||||
$mds_caps = ''
|
||||
}
|
||||
|
||||
$caps = "${mon_caps}${osd_caps}${mds_caps}"
|
||||
|
||||
# this allows multiple defines for the same 'keyring file',
|
||||
|
||||
@@ -75,10 +75,10 @@ define ceph::mon (
|
||||
|
||||
if $cluster {
|
||||
$cluster_name = $cluster
|
||||
$cluster_option = "--cluster ${cluster_name}"
|
||||
} else {
|
||||
$cluster_name = 'ceph'
|
||||
}
|
||||
$cluster_option = "--cluster ${cluster_name}"
|
||||
|
||||
# NOTE(aschultz): this is the service title for the mon service. It may be
|
||||
# different than the actual service name.
|
||||
|
||||
@@ -62,11 +62,11 @@ define ceph::osd (
|
||||
$data = $name
|
||||
|
||||
if $cluster {
|
||||
$cluster_option = "--cluster ${cluster}"
|
||||
$cluster_name = $cluster
|
||||
} else {
|
||||
$cluster_name = 'ceph'
|
||||
}
|
||||
$cluster_option = "--cluster ${cluster_name}"
|
||||
|
||||
if $ensure == present {
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ chmod 0444 /tmp/ceph-mon-keyring-A
|
||||
',
|
||||
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=$(ceph-mon --id A --show-config-value mon_data) || exit 1
|
||||
mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1
|
||||
# if ceph-mon fails then the mon is probably not configured yet
|
||||
test -e $mon_data/done
|
||||
') }
|
||||
@@ -84,12 +84,12 @@ touch /etc/ceph/ceph.client.admin.keyring'
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if getent passwd ceph >/dev/null 2>&1; then
|
||||
chown -h ceph:ceph \$mon_data
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--setuser ceph --setgroup ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
@@ -100,7 +100,7 @@ if [ ! -d \$mon_data ] ; then
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
else
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /tmp/ceph-mon-keyring-A ; then
|
||||
@@ -136,12 +136,12 @@ touch /etc/ceph/ceph.client.admin.keyring'
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if getent passwd ceph >/dev/null 2>&1; then
|
||||
chown -h ceph:ceph \$mon_data
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--setuser ceph --setgroup ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
@@ -152,7 +152,7 @@ if [ ! -d \$mon_data ] ; then
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
else
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /etc/ceph/ceph.mon.keyring ; then
|
||||
@@ -302,7 +302,7 @@ chmod 0444 /tmp/ceph-mon-keyring-A
|
||||
',
|
||||
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=$(ceph-mon --id A --show-config-value mon_data) || exit 1
|
||||
mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1
|
||||
# if ceph-mon fails then the mon is probably not configured yet
|
||||
test -e $mon_data/done
|
||||
') }
|
||||
@@ -314,12 +314,12 @@ touch /etc/ceph/ceph.client.admin.keyring'
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if getent passwd ceph >/dev/null 2>&1; then
|
||||
chown -h ceph:ceph \$mon_data
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--setuser ceph --setgroup ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
@@ -330,7 +330,7 @@ if [ ! -d \$mon_data ] ; then
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
else
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /tmp/ceph-mon-keyring-A ; then
|
||||
@@ -366,12 +366,12 @@ touch /etc/ceph/ceph.client.admin.keyring'
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if getent passwd ceph >/dev/null 2>&1; then
|
||||
chown -h ceph:ceph \$mon_data
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--setuser ceph --setgroup ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
@@ -382,7 +382,7 @@ if [ ! -d \$mon_data ] ; then
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
else
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /etc/ceph/ceph.mon.keyring ; then
|
||||
@@ -531,7 +531,7 @@ chmod 0444 /tmp/ceph-mon-keyring-A
|
||||
',
|
||||
'unless' => '/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=$(ceph-mon --id A --show-config-value mon_data) || exit 1
|
||||
mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1
|
||||
# if ceph-mon fails then the mon is probably not configured yet
|
||||
test -e $mon_data/done
|
||||
') }
|
||||
@@ -546,12 +546,12 @@ test -e /etc/ceph/ceph.client.admin.keyring'
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if getent passwd ceph >/dev/null 2>&1; then
|
||||
chown -h ceph:ceph \$mon_data
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--setuser ceph --setgroup ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
@@ -562,7 +562,7 @@ if [ ! -d \$mon_data ] ; then
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
else
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /tmp/ceph-mon-keyring-A ; then
|
||||
@@ -603,12 +603,12 @@ touch /etc/ceph/ceph.client.admin.keyring'
|
||||
it { is_expected.to contain_exec('ceph-mon-mkfs-A').with(
|
||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
mon_data=\$(ceph-mon --id A --show-config-value mon_data)
|
||||
mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data)
|
||||
if [ ! -d \$mon_data ] ; then
|
||||
mkdir -p \$mon_data
|
||||
if getent passwd ceph >/dev/null 2>&1; then
|
||||
chown -h ceph:ceph \$mon_data
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--setuser ceph --setgroup ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
@@ -619,7 +619,7 @@ if [ ! -d \$mon_data ] ; then
|
||||
rm -fr \$mon_data
|
||||
fi
|
||||
else
|
||||
if ceph-mon \
|
||||
if ceph-mon --cluster ceph \
|
||||
--mkfs \
|
||||
--id A \
|
||||
--keyring /etc/ceph/ceph.mon.keyring ; then
|
||||
|
||||
@@ -51,7 +51,7 @@ if ! test -b /srv ; then
|
||||
chown -h ceph:ceph /srv
|
||||
fi
|
||||
fi
|
||||
ceph-disk prepare /srv
|
||||
ceph-disk prepare --cluster ceph /srv
|
||||
udevadm settle
|
||||
",
|
||||
'unless' => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
@@ -193,9 +193,9 @@ if [ \"\$id\" ] ; then
|
||||
stop ceph-osd cluster=ceph id=\$id || true
|
||||
service ceph stop osd.\$id || true
|
||||
systemctl stop ceph-osd@$id || true
|
||||
ceph osd crush remove osd.\$id
|
||||
ceph auth del osd.\$id
|
||||
ceph osd rm \$id
|
||||
ceph --cluster ceph osd crush remove osd.\$id
|
||||
ceph --cluster ceph auth del osd.\$id
|
||||
ceph --cluster ceph osd rm \$id
|
||||
rm -fr /var/lib/ceph/osd/ceph-\$id/*
|
||||
umount /var/lib/ceph/osd/ceph-\$id || true
|
||||
rm -fr /var/lib/ceph/osd/ceph-\$id
|
||||
|
||||
Reference in New Issue
Block a user