Merge "replace validate_legacy with proper data types"
This commit is contained in:
commit
077d727727
@ -61,31 +61,28 @@
|
||||
# string; optional; default to undef
|
||||
#
|
||||
define openstacklib::db::mysql (
|
||||
$password = undef,
|
||||
$plugin = undef,
|
||||
$dbname = $title,
|
||||
$user = $title,
|
||||
$host = '127.0.0.1',
|
||||
$charset = 'utf8',
|
||||
$collate = 'utf8_general_ci',
|
||||
$allowed_hosts = [],
|
||||
$privileges = 'ALL',
|
||||
$create_user = true,
|
||||
$create_grant = true,
|
||||
$tls_options = ['NONE'],
|
||||
Optional[String[1]] $password = undef,
|
||||
Optional[String[1]] $plugin = undef,
|
||||
String[1] $dbname = $title,
|
||||
String[1] $user = $title,
|
||||
String[1] $host = '127.0.0.1',
|
||||
String[1] $charset = 'utf8',
|
||||
String[1] $collate = 'utf8_general_ci',
|
||||
Variant[String[1], Array[String[1]]] $allowed_hosts = [],
|
||||
Variant[String[1], Array[String[1]]] $privileges = 'ALL',
|
||||
Boolean $create_user = true,
|
||||
Boolean $create_grant = true,
|
||||
Variant[String[1], Array[String[1]]] $tls_options = ['NONE'],
|
||||
# DEPRECATED PARAMETER
|
||||
$password_hash = undef,
|
||||
Optional[String[1]] $password_hash = undef,
|
||||
) {
|
||||
|
||||
include mysql::server
|
||||
include mysql::client
|
||||
|
||||
validate_legacy(Boolean, 'validate_bool', $create_user)
|
||||
validate_legacy(Boolean, 'validate_bool', $create_grant)
|
||||
|
||||
if $password_hash != undef {
|
||||
warning('The password_hash parameter was deprecated and will be removed
|
||||
in a future release. Use password instead')
|
||||
warning("The password_hash parameter was deprecated and will be removed \
|
||||
in a future release. Use password instead")
|
||||
$password_hash_real = $password_hash
|
||||
} elsif $password != undef {
|
||||
$password_hash_real = mysql::password($password)
|
||||
|
@ -36,20 +36,19 @@
|
||||
# Defaults to ['NONE']
|
||||
#
|
||||
define openstacklib::db::mysql::host_access (
|
||||
$user,
|
||||
$password_hash,
|
||||
$database,
|
||||
$privileges,
|
||||
$plugin = undef,
|
||||
$create_user = true,
|
||||
$create_grant = true,
|
||||
$tls_options = ['NONE'],
|
||||
String[1] $user,
|
||||
String[1] $password_hash,
|
||||
String[1] $database,
|
||||
Variant[String[1], Array[String[1]]] $privileges,
|
||||
Optional[String[1]] $plugin = undef,
|
||||
Boolean $create_user = true,
|
||||
Boolean $create_grant = true,
|
||||
Variant[String[1], Array[String[1]]] $tls_options = ['NONE'],
|
||||
) {
|
||||
|
||||
validate_legacy(Pattern[/_/], 'validate_re', $title,
|
||||
['_', 'Title must be $dbname_$host'])
|
||||
validate_legacy(Boolean, 'validate_bool', $create_user)
|
||||
validate_legacy(Boolean, 'validate_bool', $create_grant)
|
||||
if ! ($title =~ /_/) {
|
||||
fail('Title must be $dbname_$host')
|
||||
}
|
||||
|
||||
$host = inline_template('<%= @title.split("_").last.downcase %>')
|
||||
|
||||
|
@ -31,13 +31,13 @@
|
||||
# string; required
|
||||
#
|
||||
define openstacklib::db::postgresql (
|
||||
$password = undef,
|
||||
$dbname = $title,
|
||||
$user = $title,
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
Optional[String[1]] $password = undef,
|
||||
String[1] $dbname = $title,
|
||||
String[1] $user = $title,
|
||||
Optional[String[1]] $encoding = undef,
|
||||
Variant[String[1], Array[String[1]]] $privileges = 'ALL',
|
||||
# DEPRECATED PARAMETERS
|
||||
$password_hash = undef,
|
||||
Optional[String[1]] $password_hash = undef,
|
||||
){
|
||||
|
||||
if $password_hash != undef {
|
||||
|
@ -17,14 +17,12 @@
|
||||
# Defaults to 'present'
|
||||
#
|
||||
class openstacklib::iscsid(
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$package_ensure = 'present'
|
||||
Boolean $enabled = true,
|
||||
Boolean $manage_service = true,
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
|
||||
include openstacklib::params
|
||||
validate_legacy(Boolean, 'validate_bool', $enabled)
|
||||
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||
|
||||
package { 'open-iscsi':
|
||||
ensure => $package_ensure,
|
||||
|
@ -62,21 +62,17 @@
|
||||
# Defaults to true
|
||||
#
|
||||
define openstacklib::messaging::rabbitmq(
|
||||
$userid = 'guest',
|
||||
$password = 'guest',
|
||||
$virtual_host = '/',
|
||||
$is_admin = false,
|
||||
$configure_permission = '.*',
|
||||
$write_permission = '.*',
|
||||
$read_permission = '.*',
|
||||
$manage_user = true,
|
||||
$manage_user_permissions = true,
|
||||
$manage_vhost = true,
|
||||
$userid = 'guest',
|
||||
$password = 'guest',
|
||||
$virtual_host = '/',
|
||||
Boolean $is_admin = false,
|
||||
$configure_permission = '.*',
|
||||
$write_permission = '.*',
|
||||
$read_permission = '.*',
|
||||
Boolean $manage_user = true,
|
||||
Boolean $manage_user_permissions = true,
|
||||
Boolean $manage_vhost = true,
|
||||
) {
|
||||
validate_legacy(Boolean, 'validate_bool', $is_admin)
|
||||
validate_legacy(Boolean, 'validate_bool', $manage_user)
|
||||
validate_legacy(Boolean, 'validate_bool', $manage_user_permissions)
|
||||
validate_legacy(Boolean, 'validate_bool', $manage_vhost)
|
||||
|
||||
if $manage_user {
|
||||
if $userid == 'guest' {
|
||||
|
@ -34,17 +34,14 @@
|
||||
# Defaults to false.
|
||||
#
|
||||
define openstacklib::policy (
|
||||
$policy_path = $name,
|
||||
$policies = {},
|
||||
$file_mode = '0640',
|
||||
$file_user = undef,
|
||||
$file_group = undef,
|
||||
$file_format = 'json',
|
||||
$purge_config = false,
|
||||
Stdlib::Absolutepath $policy_path = $name,
|
||||
Hash $policies = {},
|
||||
$file_mode = '0640',
|
||||
$file_user = undef,
|
||||
$file_group = undef,
|
||||
Enum['json', 'yaml'] $file_format = 'json',
|
||||
Boolean $purge_config = false,
|
||||
) {
|
||||
validate_legacy(Hash, 'validate_hash', $policies)
|
||||
validate_legacy(Stdlib::Absolutepath, 'validate_absolute_path', $policy_path)
|
||||
validate_legacy(Boolean, 'validate_bool', $purge_config)
|
||||
|
||||
if empty($policies) {
|
||||
create_resources('openstacklib::policy::default', { $policy_path => {
|
||||
|
@ -37,18 +37,16 @@
|
||||
# Defaults to false.
|
||||
#
|
||||
define openstacklib::policy::base (
|
||||
$file_path,
|
||||
$key,
|
||||
$value = '',
|
||||
$file_mode = '0640',
|
||||
$file_user = undef,
|
||||
$file_group = undef,
|
||||
$file_format = 'json',
|
||||
$purge_config = false,
|
||||
Stdlib::Absolutepath $file_path,
|
||||
String[1] $key,
|
||||
String $value = '',
|
||||
$file_mode = '0640',
|
||||
$file_user = undef,
|
||||
$file_group = undef,
|
||||
Enum['json', 'yaml'] $file_format = 'json',
|
||||
Boolean $purge_config = false,
|
||||
) {
|
||||
|
||||
validate_legacy(Boolean, 'validate_bool', $purge_config)
|
||||
|
||||
ensure_resource('openstacklib::policy::default', $file_path, {
|
||||
file_path => $file_path,
|
||||
file_mode => $file_mode,
|
||||
|
@ -31,14 +31,13 @@
|
||||
# Defaults to false.
|
||||
#
|
||||
define openstacklib::policy::default (
|
||||
$file_path = $name,
|
||||
$file_mode = '0640',
|
||||
$file_user = undef,
|
||||
$file_group = undef,
|
||||
$file_format = 'json',
|
||||
$purge_config = false,
|
||||
Stdlib::Absolutepath $file_path = $name,
|
||||
$file_mode = '0640',
|
||||
$file_user = undef,
|
||||
$file_group = undef,
|
||||
Enum['json', 'yaml'] $file_format = 'json',
|
||||
Boolean $purge_config = false,
|
||||
) {
|
||||
validate_legacy(Boolean, 'validate_bool', $purge_config)
|
||||
|
||||
case $file_format {
|
||||
'json': {
|
||||
|
@ -22,11 +22,9 @@
|
||||
# that should not autostart on install.
|
||||
#
|
||||
class openstacklib::policyrcd(
|
||||
$services
|
||||
Array[String[1]] $services
|
||||
) {
|
||||
|
||||
validate_legacy(Array, 'validate_array', $services)
|
||||
|
||||
if $facts['os']['family'] == 'Debian' {
|
||||
# We put this out there so openstack services wont auto start
|
||||
# when installed.
|
||||
|
Loading…
x
Reference in New Issue
Block a user