Validate ensure parameter using the typed parameters
... instead of validating the value as part of manifest logics. Change-Id: Id46cf10ca4321d2f757e5a1171c1e2900ccbc2e2
This commit is contained in:
@@ -58,7 +58,7 @@
|
|||||||
# Optional. Defaults to $ceph::params::exec_timeout
|
# Optional. Defaults to $ceph::params::exec_timeout
|
||||||
#
|
#
|
||||||
define ceph::mon (
|
define ceph::mon (
|
||||||
$ensure = present,
|
Enum['present', 'absent'] $ensure = present,
|
||||||
$mon_enable = true,
|
$mon_enable = true,
|
||||||
$public_addr = undef,
|
$public_addr = undef,
|
||||||
$cluster = undef,
|
$cluster = undef,
|
||||||
@@ -204,7 +204,7 @@ test ! -e ${keyring_path}
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} elsif $ensure == absent {
|
} else {
|
||||||
service { $mon_service:
|
service { $mon_service:
|
||||||
ensure => stopped,
|
ensure => stopped,
|
||||||
enable => $mon_enable,
|
enable => $mon_enable,
|
||||||
@@ -228,7 +228,5 @@ test ! -d \$mon_data
|
|||||||
-> ceph_config {
|
-> ceph_config {
|
||||||
"mon.${id}/public_addr": ensure => absent;
|
"mon.${id}/public_addr": ensure => absent;
|
||||||
} -> Package<| tag == 'ceph' |>
|
} -> Package<| tag == 'ceph' |>
|
||||||
} else {
|
|
||||||
fail('Ensure on MON must be either present or absent')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
# Optional. Defaults to '/etc/ceph/dmcrypt-keys'.
|
# Optional. Defaults to '/etc/ceph/dmcrypt-keys'.
|
||||||
#
|
#
|
||||||
define ceph::osd (
|
define ceph::osd (
|
||||||
$ensure = present,
|
Enum['present', 'absent'] $ensure = present,
|
||||||
$journal = undef,
|
$journal = undef,
|
||||||
$cluster = undef,
|
$cluster = undef,
|
||||||
$bluestore_wal = undef,
|
$bluestore_wal = undef,
|
||||||
@@ -235,7 +235,7 @@ ps -fCceph-osd|grep \"\\--id \$id \"
|
|||||||
tag => 'activate',
|
tag => 'activate',
|
||||||
}
|
}
|
||||||
|
|
||||||
} elsif $ensure == absent {
|
} else {
|
||||||
|
|
||||||
# ceph-disk: support osd removal http://tracker.ceph.com/issues/7454
|
# ceph-disk: support osd removal http://tracker.ceph.com/issues/7454
|
||||||
exec { "remove-osd-${name}":
|
exec { "remove-osd-${name}":
|
||||||
@@ -268,7 +268,5 @@ fi
|
|||||||
logoutput => true,
|
logoutput => true,
|
||||||
timeout => $exec_timeout,
|
timeout => $exec_timeout,
|
||||||
} -> Ceph::Mon<| ensure == absent |>
|
} -> Ceph::Mon<| ensure == absent |>
|
||||||
} else {
|
|
||||||
fail('Ensure on OSD must be either present or absent')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
# Optional. Defaults to $ceph::params::exec_timeout
|
# Optional. Defaults to $ceph::params::exec_timeout
|
||||||
#
|
#
|
||||||
define ceph::pool (
|
define ceph::pool (
|
||||||
$ensure = present,
|
Enum['present', 'absent'] $ensure = present,
|
||||||
$pg_num = 64,
|
$pg_num = 64,
|
||||||
$pgp_num = undef,
|
$pgp_num = undef,
|
||||||
$size = undef,
|
$size = undef,
|
||||||
@@ -125,7 +125,7 @@ ceph osd pool application get ${name} ${tag}",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} elsif $ensure == absent {
|
} else {
|
||||||
|
|
||||||
exec { "delete-${name}":
|
exec { "delete-${name}":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "/bin/true # comment to satisfy puppet syntax requirements
|
||||||
@@ -137,10 +137,6 @@ ceph osd pool ls | grep -w '${name}'",
|
|||||||
timeout => $exec_timeout,
|
timeout => $exec_timeout,
|
||||||
} -> Ceph::Mon<| ensure == absent |>
|
} -> Ceph::Mon<| ensure == absent |>
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
fail("*ensure* must be either present or absent - was '${ensure}'")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ test ! -d \$mon_data
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should raise_error(Puppet::Error, /Ensure on MON must be either present or absent/) }
|
it { should raise_error(Puppet::PreformattedError) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ fi
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should raise_error(Puppet::Error, /Ensure on OSD must be either present or absent/) }
|
it { should raise_error(Puppet::PreformattedError) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user