replace validate_legacy with proper data types

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

This also adds the type enforcement about purge_config which accepts
only boolean values.

Change-Id: I243572f19564a18003c3de66c1248f0f215bae65
This commit is contained in:
Takashi Kajinami 2023-08-07 10:12:29 +09:00
parent dea64e7fd3
commit 926fed1836
3 changed files with 4 additions and 10 deletions

View File

@ -21,12 +21,10 @@
# or Puppet catalog compilation will fail with duplicate resources.
#
class {{cookiecutter.project_name}}::config (
${{cookiecutter.project_name}}_config = {},
Hash ${{cookiecutter.project_name}}_config = {},
) {
include {{cookiecutter.project_name}}::deps
validate_legacy(Hash, 'validate_hash', ${{cookiecutter.project_name}}_config)
create_resources('{{cookiecutter.project_name}}_config', ${{cookiecutter.project_name}}_config)
}

View File

@ -34,7 +34,7 @@
# Defaults to 'utf8_general_ci'
#
class {{cookiecutter.project_name}}::db::mysql(
$password,
String[1] $password,
$dbname = '{{cookiecutter.project_name}}',
$user = '{{cookiecutter.project_name}}',
$host = '127.0.0.1',
@ -45,8 +45,6 @@ class {{cookiecutter.project_name}}::db::mysql(
include {{cookiecutter.project_name}}::deps
validate_legacy(String, 'validate_string', $password)
::openstacklib::db::mysql { '{{cookiecutter.project_name}}':
user => $user,
password => $password,

View File

@ -48,18 +48,16 @@
class {{cookiecutter.project_name}}::policy (
$enforce_scope = $facts['os_service_default'],
$enforce_new_defaults = $facts['os_service_default'],
$policies = {},
Hash $policies = {},
$policy_path = '/etc/{{cookiecutter.project_name}}/policy.yaml',
$policy_default_rule = $facts['os_service_default'],
$policy_dirs = $facts['os_service_default'],
$purge_config = false,
Boolean $purge_config = false,
) {
include {{cookiecutter.project_name}}::deps
include {{cookiecutter.project_name}}::params
validate_legacy(Hash, 'validate_hash', $policies)
$policy_parameters = {
policies => $policies,
policy_path => $policy_path,