puppet-murano/manifests/cfapi.pp
Takashi Kajinami 63904655f1 Add strict validation about boolean parameters
This ensures the parameters used by if-else logic accept only boolean
values because non-boolean can result in unexpected behavior.

Change-Id: I9f98a8c3d470a45f62d1165f32a783a840aa7bdb
2023-07-26 17:32:02 +09:00

91 lines
2.5 KiB
Puppet

# == Class: murano::cfapi
#
# murano service broker package & service
#
# === Parameters
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet
# Defaults to true
#
# [*enabled*]
# (Optional) Should the service be enabled
# Defaults to true
#
# [*package_ensure*]
# (Optional) Ensure state for package
# Defaults to 'present'
#
# [*tenant*]
# (Optional) Tenant for cloudfoundry api
# Defaults to 'admin'
#
# [*bind_host*]
# (Optional) Host on which murano cloudfoundry api should listen
# Defaults to $facts['os_service_default'].
#
# [*bind_port*]
# (Optional) Port on which murano cloudfoundry api should listen
# Defaults to $facts['os_service_default'].
#
# [*auth_url*]
# (Optional) Public identity endpoint
# Defaults to 'http://127.0.0.1:5000'.
#
# [*user_domain_name*]
# (Optional) User Domain name for connecting to Murano CFAPI services in
# admin context through the OpenStack Identity service.
# Defaults to $facts['os_service_default'].
#
# [*project_domain_name*]
# (Optional) Project Domain name for connecting to Murano CFAPI services in
# admin context through the OpenStack Identity service.
# Defaults to $facts['os_service_default'].
#
class murano::cfapi(
$tenant = 'admin',
Boolean $manage_service = true,
Boolean $enabled = true,
$package_ensure = 'present',
$bind_host = $facts['os_service_default'],
$bind_port = $facts['os_service_default'],
$auth_url = 'http://127.0.0.1:5000',
$user_domain_name = $facts['os_service_default'],
$project_domain_name = $facts['os_service_default'],
) {
include murano::deps
include murano::params
include murano::policy
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
service { 'murano-cfapi':
ensure => $service_ensure,
name => $::murano::params::cfapi_service_name,
enable => $enabled,
tag => 'murano-service',
}
}
murano_cfapi_config {
'cfapi/tenant': value => $tenant;
'cfapi/bind_host': value => $bind_host;
'cfapi/bind_port': value => $bind_port;
'cfapi/auth_url': value => $auth_url;
'cfapi/user_domain_name': value => $user_domain_name;
'cfapi/project_domain_name': value => $project_domain_name;
}
package { 'murano-cfapi':
ensure => $package_ensure,
name => $::murano::params::cfapi_package_name,
tag => ['openstack', 'murano-package'],
}
}