Fix undefined variables caused by exec_timeout
This fixes the following error found in Puppet 8 unit tests. Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown variable: 'ceph::params::exec_timeout'. Change-Id: I0030baf97f831384d5dad46dbaeb1ee5169cfe21
This commit is contained in:
@ -39,8 +39,15 @@
|
||||
define ceph::fs (
|
||||
$metadata_pool,
|
||||
$data_pool,
|
||||
$exec_timeout = $ceph::params::exec_timeout,
|
||||
$exec_timeout = undef,
|
||||
) {
|
||||
|
||||
include ceph::params
|
||||
$exec_timeout_real = $exec_timeout ? {
|
||||
undef => $ceph::params::exec_timeout,
|
||||
default => $exec_timeout,
|
||||
}
|
||||
|
||||
Ceph_config<||> -> Exec["create-fs-${name}"]
|
||||
Ceph::Pool<||> -> Exec["create-fs-${name}"]
|
||||
|
||||
@ -51,6 +58,6 @@ ceph fs new ${name} ${metadata_pool} ${data_pool}",
|
||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph fs ls | grep 'name: ${name},'",
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,13 @@ define ceph::mon (
|
||||
Enum['cephx', 'none'] $authentication_type = 'cephx',
|
||||
$key = undef,
|
||||
$keyring = undef,
|
||||
$exec_timeout = $ceph::params::exec_timeout,
|
||||
$exec_timeout = undef
|
||||
) {
|
||||
include ceph::params
|
||||
$exec_timeout_real = $exec_timeout ? {
|
||||
undef => $ceph::params::exec_timeout,
|
||||
default => $exec_timeout,
|
||||
}
|
||||
|
||||
# a puppet name translates into a ceph id, the meaning is different
|
||||
$id = $name
|
||||
@ -178,7 +183,7 @@ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
|
||||
test -d \$mon_data
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
-> service { $mon_service:
|
||||
ensure => running,
|
||||
@ -223,7 +228,7 @@ mon_data=\$(ceph-mon ${cluster_option} --id ${id} --show-config-value mon_data)
|
||||
test ! -d \$mon_data
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
-> ceph_config {
|
||||
"mon.${id}/public_addr": ensure => absent;
|
||||
|
@ -73,7 +73,7 @@ define ceph::osd (
|
||||
$bluestore_wal = undef,
|
||||
$bluestore_db = undef,
|
||||
Optional[Enum['filestore', 'bluestore']] $store_type = undef,
|
||||
$exec_timeout = $ceph::params::exec_timeout,
|
||||
$exec_timeout = undef,
|
||||
$selinux_file_context = 'ceph_var_lib_t',
|
||||
$fsid = $ceph::profile::params::fsid,
|
||||
Boolean $dmcrypt = false,
|
||||
@ -81,6 +81,10 @@ define ceph::osd (
|
||||
) {
|
||||
|
||||
include ceph::params
|
||||
$exec_timeout_real = $exec_timeout ? {
|
||||
undef => $ceph::params::exec_timeout,
|
||||
default => $exec_timeout,
|
||||
}
|
||||
|
||||
$data = $name
|
||||
|
||||
@ -152,7 +156,7 @@ fi
|
||||
test ${fsid} = $(ceph-volume lvm list ${data} |grep 'cluster fsid' | awk -F'fsid' '{print \$2}'|tr -d ' ')
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
} else {
|
||||
$fsid_option = ''
|
||||
@ -191,7 +195,7 @@ set -ex
|
||||
ceph-volume lvm list ${data}
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
tag => 'prepare',
|
||||
}
|
||||
if (str2bool($facts['os']['selinux']['enabled']) == true) {
|
||||
@ -266,7 +270,7 @@ else
|
||||
fi
|
||||
",
|
||||
logoutput => true,
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
} -> Ceph::Mon<| ensure == absent |>
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,15 @@ define ceph::pool (
|
||||
$pgp_num = undef,
|
||||
$size = undef,
|
||||
$tag = undef,
|
||||
$exec_timeout = $ceph::params::exec_timeout,
|
||||
$exec_timeout = undef,
|
||||
) {
|
||||
|
||||
include ceph::params
|
||||
$exec_timeout_real = $exec_timeout ? {
|
||||
undef => $ceph::params::exec_timeout,
|
||||
default => $exec_timeout,
|
||||
}
|
||||
|
||||
if $ensure == present {
|
||||
|
||||
Ceph_config<||> -> Exec["create-${name}"]
|
||||
@ -72,7 +78,7 @@ ceph osd pool create ${name} ${pg_num}",
|
||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph osd pool ls | grep -w '${name}'",
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
|
||||
exec { "set-${name}-pg_num":
|
||||
@ -83,7 +89,7 @@ ceph osd pool set ${name} pg_num ${pg_num}",
|
||||
set -ex
|
||||
test $(ceph osd pool get ${name} pg_num | sed 's/.*:\s*//g') -ge ${pg_num}",
|
||||
require => Exec["create-${name}"],
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
|
||||
if $pgp_num {
|
||||
@ -95,7 +101,7 @@ ceph osd pool set ${name} pgp_num ${pgp_num}",
|
||||
set -ex
|
||||
test $(ceph osd pool get ${name} pgp_num | sed 's/.*:\s*//g') -ge ${pgp_num}",
|
||||
require => [Exec["create-${name}"], Exec["set-${name}-pg_num"]],
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +114,7 @@ ceph osd pool set ${name} size ${size}",
|
||||
set -ex
|
||||
test $(ceph osd pool get ${name} size | sed 's/.*:\s*//g') -eq ${size}",
|
||||
require => Exec["create-${name}"],
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +127,7 @@ ceph osd pool application enable ${name} ${tag}",
|
||||
set -ex
|
||||
ceph osd pool application get ${name} ${tag}",
|
||||
require => Exec["create-${name}"],
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +140,7 @@ ceph osd pool delete ${name} ${name} --yes-i-really-really-mean-it",
|
||||
onlyif => "/bin/true # comment to satisfy puppet syntax requirements
|
||||
set -ex
|
||||
ceph osd pool ls | grep -w '${name}'",
|
||||
timeout => $exec_timeout,
|
||||
timeout => $exec_timeout_real,
|
||||
} -> Ceph::Mon<| ensure == absent |>
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user