Merge "Do not use params to define parameter defaults of defined types"

This commit is contained in:
Zuul 2023-08-07 16:26:31 +00:00 committed by Gerrit Code Review
commit 76de1ad356
2 changed files with 13 additions and 12 deletions

View File

@ -88,16 +88,16 @@
# Optional. Default is false # Optional. Default is false
# #
define ceph::rgw ( define ceph::rgw (
$pkg_radosgw = $ceph::params::pkg_radosgw, $pkg_radosgw = undef,
$rgw_ensure = 'running', $rgw_ensure = 'running',
$rgw_enable = true, $rgw_enable = true,
$rgw_enable_apis = undef, $rgw_enable_apis = undef,
Stdlib::Absolutepath $rgw_data = "/var/lib/ceph/radosgw/ceph-${name}", Stdlib::Absolutepath $rgw_data = "/var/lib/ceph/radosgw/ceph-${name}",
$user = $ceph::params::user_radosgw, $user = undef,
Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.client.${name}.keyring", Stdlib::Absolutepath $keyring_path = "/etc/ceph/ceph.client.${name}.keyring",
Stdlib::Absolutepath $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 = undef,
$rgw_print_continue = false, $rgw_print_continue = false,
$rgw_port = undef, $rgw_port = undef,
$frontend_type = 'civetweb', $frontend_type = 'civetweb',
@ -113,6 +113,11 @@ define ceph::rgw (
fail("Define name must be started with 'radosgw.'") fail("Define name must be started with 'radosgw.'")
} }
include ceph::params
$pkg_radosgw_real = pick($pkg_radosgw, $ceph::params::pkg_radosgw)
$user_real = pick($user, $ceph::params::user_radosgw)
$rgw_socket_path_real = pick($rgw_socket_path, $ceph::params::rgw_socket_path)
if $rgw_enable_apis == undef { if $rgw_enable_apis == undef {
ceph_config { "client.${name}/rgw_enable_apis": ensure => absent } ceph_config { "client.${name}/rgw_enable_apis": ensure => absent }
} else { } else {
@ -123,7 +128,7 @@ define ceph::rgw (
"client.${name}/host": value => $facts['networking']['hostname']; "client.${name}/host": value => $facts['networking']['hostname'];
"client.${name}/keyring": value => $keyring_path; "client.${name}/keyring": value => $keyring_path;
"client.${name}/log_file": value => $log_file; "client.${name}/log_file": value => $log_file;
"client.${name}/user": value => $user; "client.${name}/user": value => $user_real;
"client.${name}/rgw_data": value => $rgw_data; "client.${name}/rgw_data": value => $rgw_data;
"client.${name}/rgw_dns_name": value => $rgw_dns_name; "client.${name}/rgw_dns_name": value => $rgw_dns_name;
"client.${name}/rgw_swift_url": value => $rgw_swift_url; "client.${name}/rgw_swift_url": value => $rgw_swift_url;
@ -151,7 +156,7 @@ define ceph::rgw (
ceph_config { ceph_config {
"client.${name}/rgw_port": value => $rgw_port; "client.${name}/rgw_port": value => $rgw_port;
"client.${name}/rgw_print_continue": value => $rgw_print_continue; "client.${name}/rgw_print_continue": value => $rgw_print_continue;
"client.${name}/rgw_socket_path": value => $rgw_socket_path; "client.${name}/rgw_socket_path": value => $rgw_socket_path_real;
} }
} }
'apache-proxy-fcgi': { 'apache-proxy-fcgi': {
@ -162,7 +167,7 @@ define ceph::rgw (
ceph_config { ceph_config {
"client.${name}/rgw_frontends": value => $rgw_frontends_real; "client.${name}/rgw_frontends": value => $rgw_frontends_real;
"client.${name}/rgw_print_continue": value => $rgw_print_continue; "client.${name}/rgw_print_continue": value => $rgw_print_continue;
"client.${name}/rgw_socket_path": value => $rgw_socket_path; "client.${name}/rgw_socket_path": value => $rgw_socket_path_real;
} }
} }
default: { default: {
@ -170,7 +175,7 @@ define ceph::rgw (
} }
} }
package { $pkg_radosgw: package { $pkg_radosgw_real:
ensure => installed, ensure => installed,
tag => 'ceph', tag => 'ceph',
} }
@ -187,7 +192,7 @@ define ceph::rgw (
# Log file for radosgw (ownership) # Log file for radosgw (ownership)
file { $log_file: file { $log_file:
ensure => present, ensure => present,
owner => $user, owner => $user_real,
mode => '0640', mode => '0640',
selinux_ignore_defaults => true, selinux_ignore_defaults => true,
} }

View File

@ -18,10 +18,6 @@
require 'spec_helper' require 'spec_helper'
describe 'ceph::rgw' do describe 'ceph::rgw' do
let :pre_condition do
'include ceph::params'
end
shared_examples 'ceph::rgw' do shared_examples 'ceph::rgw' do
context 'activated with default params' do context 'activated with default params' do
let :title do let :title do