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
|
||||
#
|
||||
define ceph::mon (
|
||||
$ensure = present,
|
||||
Enum['present', 'absent'] $ensure = present,
|
||||
$mon_enable = true,
|
||||
$public_addr = undef,
|
||||
$cluster = undef,
|
||||
@@ -204,7 +204,7 @@ test ! -e ${keyring_path}
|
||||
}
|
||||
}
|
||||
|
||||
} elsif $ensure == absent {
|
||||
} else {
|
||||
service { $mon_service:
|
||||
ensure => stopped,
|
||||
enable => $mon_enable,
|
||||
@@ -228,7 +228,5 @@ test ! -d \$mon_data
|
||||
-> ceph_config {
|
||||
"mon.${id}/public_addr": ensure => absent;
|
||||
} -> 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'.
|
||||
#
|
||||
define ceph::osd (
|
||||
$ensure = present,
|
||||
Enum['present', 'absent'] $ensure = present,
|
||||
$journal = undef,
|
||||
$cluster = undef,
|
||||
$bluestore_wal = undef,
|
||||
@@ -235,7 +235,7 @@ ps -fCceph-osd|grep \"\\--id \$id \"
|
||||
tag => 'activate',
|
||||
}
|
||||
|
||||
} elsif $ensure == absent {
|
||||
} else {
|
||||
|
||||
# ceph-disk: support osd removal http://tracker.ceph.com/issues/7454
|
||||
exec { "remove-osd-${name}":
|
||||
@@ -268,7 +268,5 @@ fi
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
} -> 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
|
||||
#
|
||||
define ceph::pool (
|
||||
$ensure = present,
|
||||
Enum['present', 'absent'] $ensure = present,
|
||||
$pg_num = 64,
|
||||
$pgp_num = undef,
|
||||
$size = undef,
|
||||
@@ -125,7 +125,7 @@ ceph osd pool application get ${name} ${tag}",
|
||||
}
|
||||
}
|
||||
|
||||
} elsif $ensure == absent {
|
||||
} else {
|
||||
|
||||
exec { "delete-${name}":
|
||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
@@ -137,10 +137,6 @@ ceph osd pool ls | grep -w '${name}'",
|
||||
timeout => $exec_timeout,
|
||||
} -> Ceph::Mon<| ensure == absent |>
|
||||
|
||||
} else {
|
||||
|
||||
fail("*ensure* must be either present or absent - was '${ensure}'")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -259,7 +259,7 @@ test ! -d \$mon_data
|
||||
}
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error, /Ensure on MON must be either present or absent/) }
|
||||
it { should raise_error(Puppet::PreformattedError) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -511,7 +511,7 @@ fi
|
||||
}
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error, /Ensure on OSD must be either present or absent/) }
|
||||
it { should raise_error(Puppet::PreformattedError) }
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user