replace validate_legacy with proper data types

the validate_legacy function is marked for deprecation in
v9.0.0 from puppetlabs-stdlib.

Change-Id: I8656f4aba542881afa68966cc63bd8c085b52bda
This commit is contained in:
Takashi Kajinami 2023-06-16 02:14:29 +09:00
parent 41268f3493
commit 0827ad6fc3
4 changed files with 44 additions and 69 deletions

View File

@ -94,32 +94,26 @@
# override this to notifier:// instead.
#
class ceilometer::agent::notification (
$manage_service = true,
$enabled = true,
$ack_on_event_error = $facts['os_service_default'],
$disable_non_metric_meters = $facts['os_service_default'],
$workers = $facts['os_service_default'],
$messaging_urls = $facts['os_service_default'],
$batch_size = $facts['os_service_default'],
$batch_timeout = $facts['os_service_default'],
$package_ensure = 'present',
$manage_event_pipeline = false,
$event_pipeline_publishers = ['gnocchi://'],
$event_pipeline_config = undef,
$manage_pipeline = false,
$pipeline_publishers = ['gnocchi://'],
$pipeline_config = undef,
Boolean $manage_service = true,
Boolean $enabled = true,
$ack_on_event_error = $facts['os_service_default'],
$disable_non_metric_meters = $facts['os_service_default'],
$workers = $facts['os_service_default'],
$messaging_urls = $facts['os_service_default'],
$batch_size = $facts['os_service_default'],
$batch_timeout = $facts['os_service_default'],
$package_ensure = 'present',
Boolean $manage_event_pipeline = false,
Array[String[1]] $event_pipeline_publishers = ['gnocchi://'],
Optional[Hash] $event_pipeline_config = undef,
Boolean $manage_pipeline = false,
Array[String[1]] $pipeline_publishers = ['gnocchi://'],
Optional[Hash] $pipeline_config = undef,
) {
include ceilometer::deps
include ceilometer::params
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_event_pipeline)
validate_legacy(Boolean, 'validate_bool', $manage_pipeline)
package { 'ceilometer-notification':
ensure => $package_ensure,
name => $::ceilometer::params::agent_notification_package_name,
@ -145,10 +139,8 @@ class ceilometer::agent::notification (
if $manage_event_pipeline {
if $event_pipeline_config {
validate_legacy(Hash, 'validate_hash', $event_pipeline_config)
$event_pipeline_content = to_yaml($event_pipeline_config)
} else {
validate_legacy(Array, 'validate_array', $event_pipeline_publishers)
$event_pipeline_content = template('ceilometer/event_pipeline.yaml.erb')
}
@ -166,10 +158,8 @@ class ceilometer::agent::notification (
if $manage_pipeline {
if $pipeline_config {
validate_legacy(Hash, 'validate_hash', $pipeline_config)
$pipeline_content = to_yaml($pipeline_config)
} else {
validate_legacy(Array, 'validate_array', $pipeline_publishers)
$pipeline_content = template('ceilometer/pipeline.yaml.erb')
}

View File

@ -82,37 +82,28 @@
# Defaults to $facts['os_service_default'].
#
class ceilometer::agent::polling (
$manage_service = true,
$enabled = true,
$separate_services = false,
$package_ensure = 'present',
$manage_user = true,
$central_namespace = true,
$compute_namespace = true,
$ipmi_namespace = true,
$instance_discovery_method = $facts['os_service_default'],
$resource_update_interval = $facts['os_service_default'],
$resource_cache_expiry = $facts['os_service_default'],
$manage_polling = false,
$polling_interval = 600,
$polling_meters = $::ceilometer::params::polling_meters,
$polling_config = undef,
$batch_size = $facts['os_service_default'],
$tenant_name_discovery = $facts['os_service_default'],
Boolean $manage_service = true,
Boolean $enabled = true,
Boolean $separate_services = false,
$package_ensure = 'present',
Boolean $manage_user = true,
Boolean $central_namespace = true,
Boolean $compute_namespace = true,
Boolean $ipmi_namespace = true,
$instance_discovery_method = $facts['os_service_default'],
$resource_update_interval = $facts['os_service_default'],
$resource_cache_expiry = $facts['os_service_default'],
Boolean $manage_polling = false,
$polling_interval = 600,
$polling_meters = $::ceilometer::params::polling_meters,
Optional[Hash]$polling_config = undef,
$batch_size = $facts['os_service_default'],
$tenant_name_discovery = $facts['os_service_default'],
) inherits ceilometer {
include ceilometer::deps
include ceilometer::params
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $separate_services)
validate_legacy(Boolean, 'validate_bool', $manage_user)
validate_legacy(Boolean, 'validate_bool', $central_namespace)
validate_legacy(Boolean, 'validate_bool', $compute_namespace)
validate_legacy(Boolean, 'validate_bool', $ipmi_namespace)
validate_legacy(Boolean, 'validate_bool', $manage_polling)
if $central_namespace {
$central_namespace_name = 'central'
ceilometer_config {
@ -280,7 +271,6 @@ class ceilometer::agent::polling (
if $manage_polling {
if $polling_config {
validate_legacy(Hash, 'validate_hash', $polling_config)
$polling_content = to_yaml($polling_config)
} else {
$polling_content = template('ceilometer/polling.yaml.erb')

View File

@ -26,15 +26,12 @@
# or Puppet catalog compilation will fail with duplicate resources.
#
class ceilometer::config (
$ceilometer_config = {},
$ceilometer_rootwrap_config = {},
Hash $ceilometer_config = {},
Hash $ceilometer_rootwrap_config = {},
) {
include ceilometer::deps
validate_legacy(Hash, 'validate_hash', $ceilometer_config)
validate_legacy(Hash, 'validate_hash', $ceilometer_rootwrap_config)
create_resources('ceilometer_config', $ceilometer_config)
create_resources('ceilometer_rootwrap_config', $ceilometer_rootwrap_config)

View File

@ -50,22 +50,20 @@
# }
#
class ceilometer::keystone::auth (
$password = false,
$email = 'ceilometer@localhost',
$auth_name = 'ceilometer',
$configure_user = true,
$configure_user_role = true,
$region = 'RegionOne',
$tenant = 'services',
$roles = ['admin'],
$system_scope = 'all',
$system_roles = [],
String[1] $password,
$email = 'ceilometer@localhost',
$auth_name = 'ceilometer',
$configure_user = true,
$configure_user_role = true,
$region = 'RegionOne',
$tenant = 'services',
$roles = ['admin'],
$system_scope = 'all',
$system_roles = [],
) {
include ceilometer::deps
validate_legacy(String, 'validate_string', $password)
# Ceilometer requires only its user, project, and role assignment.
# service and endpoint should be disabled since ceilometer-api has been removed.
keystone::resource::service_identity { 'ceilometer':