From 926fed18361fd5a59a862504759d90708230fefd Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 7 Aug 2023 10:12:29 +0900 Subject: [PATCH] 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 --- puppet-{{cookiecutter.project_name}}/manifests/config.pp | 4 +--- puppet-{{cookiecutter.project_name}}/manifests/db/mysql.pp | 4 +--- puppet-{{cookiecutter.project_name}}/manifests/policy.pp | 6 ++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/puppet-{{cookiecutter.project_name}}/manifests/config.pp b/puppet-{{cookiecutter.project_name}}/manifests/config.pp index 3ec1efd..07edbb7 100644 --- a/puppet-{{cookiecutter.project_name}}/manifests/config.pp +++ b/puppet-{{cookiecutter.project_name}}/manifests/config.pp @@ -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) } diff --git a/puppet-{{cookiecutter.project_name}}/manifests/db/mysql.pp b/puppet-{{cookiecutter.project_name}}/manifests/db/mysql.pp index 0946a67..367ad5b 100644 --- a/puppet-{{cookiecutter.project_name}}/manifests/db/mysql.pp +++ b/puppet-{{cookiecutter.project_name}}/manifests/db/mysql.pp @@ -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, diff --git a/puppet-{{cookiecutter.project_name}}/manifests/policy.pp b/puppet-{{cookiecutter.project_name}}/manifests/policy.pp index e02092f..470ed2c 100644 --- a/puppet-{{cookiecutter.project_name}}/manifests/policy.pp +++ b/puppet-{{cookiecutter.project_name}}/manifests/policy.pp @@ -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,