Ensure absolute path for file creation

There are a few parameters used as a file path when creating files.
These should be absolute path, otherwise file resources fail.

This adds validation at parameter layer to avoid exposing internal
errors.

Change-Id: I348838c5ca736056dac00c2a0b1ab5063d4d9289
This commit is contained in:
Takashi Kajinami 2023-07-21 14:56:41 +09:00
parent df03ad0501
commit e746c9e412
3 changed files with 30 additions and 30 deletions

View File

@ -77,7 +77,7 @@
define ceph::key ( define ceph::key (
$secret, $secret,
$cluster = undef, $cluster = undef,
$keyring_path = "/etc/ceph/ceph.${name}.keyring", Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.${name}.keyring",
$cap_mon = undef, $cap_mon = undef,
$cap_osd = undef, $cap_osd = undef,
$cap_mds = undef, $cap_mds = undef,

View File

@ -51,16 +51,16 @@
# Optional. Default to 'ceph'. # Optional. Default to 'ceph'.
# #
class ceph::mds ( class ceph::mds (
$public_addr = undef, $public_addr = undef,
$pkg_mds = $ceph::params::pkg_mds, $pkg_mds = $ceph::params::pkg_mds,
$pkg_mds_ensure = present, $pkg_mds_ensure = present,
Boolean $mds_activate = true, Boolean $mds_activate = true,
$mds_data = undef, Optional[Stdlib::Absolutepath] $mds_data = undef,
$mds_enable = true, $mds_enable = true,
$mds_ensure = 'running', $mds_ensure = 'running',
$mds_id = $facts['networking']['hostname'], $mds_id = $facts['networking']['hostname'],
$keyring = undef, $keyring = undef,
$cluster = 'ceph', $cluster = 'ceph',
) inherits ceph::params { ) inherits ceph::params {
if $mds_data { if $mds_data {
$mds_data_real = $mds_data $mds_data_real = $mds_data

View File

@ -88,25 +88,25 @@
# Optional. Default is false # Optional. Default is false
# #
define ceph::rgw ( define ceph::rgw (
$pkg_radosgw = $ceph::params::pkg_radosgw, $pkg_radosgw = $ceph::params::pkg_radosgw,
$rgw_ensure = 'running', $rgw_ensure = 'running',
$rgw_enable = true, $rgw_enable = true,
$rgw_enable_apis = undef, $rgw_enable_apis = undef,
$rgw_data = "/var/lib/ceph/radosgw/ceph-${name}", Stdlib::Absolutepath $rgw_data = "/var/lib/ceph/radosgw/ceph-${name}",
$user = $ceph::params::user_radosgw, $user = $ceph::params::user_radosgw,
$keyring_path = "/etc/ceph/ceph.client.${name}.keyring", Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.client.${name}.keyring",
$log_file = '/var/log/ceph/radosgw.log', Stdlib::Absolutepath $log_file = '/var/log/ceph/radosgw.log',
$rgw_dns_name = $facts['networking']['fqdn'], $rgw_dns_name = $facts['networking']['fqdn'],
$rgw_socket_path = $ceph::params::rgw_socket_path, $rgw_socket_path = $ceph::params::rgw_socket_path,
$rgw_print_continue = false, $rgw_print_continue = false,
$rgw_port = undef, $rgw_port = undef,
$frontend_type = 'civetweb', $frontend_type = 'civetweb',
$rgw_frontends = undef, $rgw_frontends = undef,
$rgw_swift_url = "http://${facts['networking']['fqdn']}:7480", $rgw_swift_url = "http://${facts['networking']['fqdn']}:7480",
$rgw_swift_url_prefix = 'swift', $rgw_swift_url_prefix = 'swift',
$rgw_swift_account_in_url = false, $rgw_swift_account_in_url = false,
$rgw_swift_versioning_enabled = false, $rgw_swift_versioning_enabled = false,
$rgw_trust_forwarded_https = false, $rgw_trust_forwarded_https = false,
) { ) {
unless $name =~ /^radosgw\..+/ { unless $name =~ /^radosgw\..+/ {