Adapt synced sahara module

- add patch I542a8b6ed3aaf18e4b352f821939fc5f262aa5eb;
- add patch Id3aa75229e8626c71d6cb8398af3c2c22f37b592;
- add new noop tests;
- adapt Sahara modular manifest;

Closes-bug: #1425513
Related-bug: #1425514
Partial implements: blueprint separate-sahara-package
Partial implements: blueprint upgrade-openstack-puppet-modules

Change-Id: I9b3f4b25db5fc3c3dfc727faa5d2c493bc748966
This commit is contained in:
Denis Egorenko 2015-07-15 20:06:32 +03:00 committed by degorenko
parent 3135f4afd1
commit 334fb0894a
24 changed files with 1658 additions and 377 deletions

View File

@ -0,0 +1,32 @@
notice('MODULAR: sahara/keystone.pp')
$sahara_hash = hiera_hash('sahara_hash', {})
$public_ssl_hash = hiera('public_ssl')
$public_address = hiera('public_vip')
$internal_address = hiera('management_vip', $public_address)
$api_bind_port = '8386'
$sahara_user = pick($sahara_hash['user'], 'sahara')
$sahara_password = pick($sahara_hash['user_password'])
$tenant = pick($sahara_hash['tenant'], 'services')
$region = pick($sahara_hash['region'], 'RegionOne')
$service_name = pick($sahara_hash['service_name'], 'sahara')
$public_protocol = $public_ssl_hash['services'] ? {
true => 'https',
default => 'http',
}
$public_url = "${public_protocol}://${public_address}:${api_bind_port}/v1.1/%(tenant_id)s"
$admin_url = "http://${internal_address}:${api_bind_port}/v1.1/%(tenant_id)s"
$internal_url = "http://${internal_address}:${api_bind_port}/v1.1/%(tenant_id)s"
class { 'sahara::keystone::auth':
auth_name => $sahara_user,
password => $sahara_password,
service_type => 'data_processing',
service_name => $service_name,
region => $region,
tenant => $tenant,
public_url => $public_url,
admin_url => $admin_url,
internal_url => $internal_url,
}

View File

@ -1,84 +1,119 @@
notice('MODULAR: sahara.pp')
$access_admin = hiera_hash('access_hash', {})
$sahara_hash = hiera_hash('sahara_hash', {})
$rabbit_hash = hiera_hash('rabbit_hash', {})
$public_ssl_hash = hiera('public_ssl')
$ceilometer_hash = hiera_hash('ceilometer_hash', {})
$primary_controller = hiera('primary_controller')
$sahara_hash = hiera_hash('sahara_hash')
$access_admin = hiera('access')
$controller_node_address = hiera('controller_node_address')
$controller_node_public = hiera('controller_node_public')
$public_ip = hiera('public_vip', $controller_node_public)
$management_ip = hiera('management_vip', $controller_node_address)
$public_vip = hiera('public_vip')
$internal_address = hiera('internal_address')
$database_vip = hiera('database_vip', $internal_address)
$use_neutron = hiera('use_neutron', false)
$service_endpoint = hiera('service_endpoint')
$syslog_log_facility_sahara = hiera('syslog_log_facility_sahara')
$ceilometer_hash = hiera('ceilometer')
$debug = hiera('debug', false)
$verbose = hiera('verbose', true)
$use_syslog = hiera('use_syslog', true)
$rabbit_hash = hiera_hash('rabbit_hash')
$rabbit_ha_queues = hiera('rabbit_ha_queues')
$amqp_port = hiera('amqp_port')
$amqp_hosts = hiera('amqp_hosts')
$rabbit_ha_queues = hiera('rabbit_ha_queues')
$deployment_mode = hiera('deployment_mode')
$public_ssl_hash = hiera_hash('public_ssl')
#################################################################
if $sahara_hash['enabled'] {
####### Disable upstart startup on install #######
if($::operatingsystem == 'Ubuntu') {
tweaks::ubuntu_service_override { 'sahara-api':
package_name => 'sahara',
}
}
class { 'sahara' :
api_host => $public_ip,
db_password => $sahara_hash['db_password'],
db_host => $management_ip,
keystone_host => $service_endpoint,
keystone_user => 'sahara',
keystone_password => $sahara_hash['user_password'],
keystone_tenant => 'services',
auth_uri => "http://${service_endpoint}:5000/v2.0/",
identity_uri => "http://${service_endpoint}:35357/",
public_ssl => $public_ssl_hash['services'],
use_neutron => $use_neutron,
syslog_log_facility => $syslog_log_facility_sahara,
debug => $debug,
verbose => $verbose,
use_syslog => $use_syslog,
enable_notifications => $ceilometer_hash['enabled'],
rpc_backend => 'rabbit',
amqp_password => $rabbit_hash['password'],
amqp_user => $rabbit_hash['user'],
amqp_port => $amqp_port,
amqp_hosts => $amqp_hosts,
rabbit_ha_queues => $rabbit_ha_queues,
}
$haproxy_stats_url = "http://${management_ip}:10000/;csv"
haproxy_backend_status { 'sahara' :
name => 'sahara',
url => $haproxy_stats_url,
}
if $primary_controller {
class { 'sahara_templates::create_templates' :
use_neutron => $use_neutron,
auth_user => $access_admin['user'],
auth_password => $access_admin['password'],
auth_tenant => $access_admin['tenant'],
auth_uri => "http://${management_ip}:5000/v2.0/",
}
Haproxy_backend_status['sahara'] -> Class['sahara_templates::create_templates']
}
Class['sahara'] -> Haproxy_backend_status['sahara']
Service['sahara'] -> Haproxy_backend_status['sahara']
$firewall_rule = '201 sahara-api'
$api_bind_port = '8386'
$api_bind_host = $internal_address
$api_workers = '4'
$public_address = $public_ssl_hash['services'] ? {
true => $public_ssl_hash['hostname'],
default => $public_vip,
}
$public_protocol = $public_ssl_hash['services'] ? {
true => 'https',
default => 'http',
}
$sahara_user = pick($sahara_hash['user'], 'sahara')
$sahara_password = pick($sahara_hash['user_password'])
$tenant = pick($sahara_hash['tenant'], 'services')
$db_user = pick($sahara_hash['db_user'], 'sahara')
$db_name = pick($sahara_hash['db_name'], 'sahara')
$db_password = pick($sahara_hash['db_password'])
$db_host = pick($sahara_hash['db_host'], $database_vip)
$read_timeout = '60'
$sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_name}?read_timeout=${read_timeout}"
####### Disable upstart startup on install #######
tweaks::ubuntu_service_override { 'sahara-api':
package_name => 'sahara',
}
firewall { $firewall_rule :
dport => $api_bind_port,
proto => 'tcp',
action => 'accept',
}
class { 'sahara' :
verbose => $verbose,
debug => $debug,
use_syslog => $use_syslog,
log_facility => $syslog_log_facility_sahara,
database_connection => $sql_connection,
auth_uri => "${public_protocol}://${public_address}:5000/v2.0/",
identity_uri => "http://${service_endpoint}:35357/",
rpc_backend => 'rabbit',
use_neutron => $use_neutron,
admin_user => $sahara_user,
admin_password => $sahara_password,
admin_tenant_name => $tenant,
rabbit_userid => $rabbit_hash['user'],
rabbit_password => $rabbit_hash['password'],
rabbit_ha_queues => $rabbit_ha_queues,
rabbit_port => $amqp_port,
rabbit_hosts => split($amqp_hosts, ',')
}
class { 'sahara::api':
api_workers => $api_workers,
host => $api_bind_host,
port => $api_bind_port,
}
class { 'sahara::engine':
infrastructure_engine => 'heat',
}
class { 'sahara::client': }
if $ceilometer_hash['enabled'] {
class { '::sahara::notify':
enable_notifications => true,
}
}
$haproxy_stats_url = "http://${database_vip}:10000/;csv"
haproxy_backend_status { 'sahara' :
name => 'sahara',
url => $haproxy_stats_url,
}
# Temporarily disable as workaround for bug 1476324
#if $primary_controller {
# class { 'sahara_templates::create_templates' :
# use_neutron => $use_neutron,
# auth_user => $access_admin['user'],
# auth_password => $access_admin['password'],
# auth_tenant => $access_admin['tenant'],
# auth_uri => "${public_protocol}://${public_address}:5000/v2.0/",
# }
#
# Haproxy_backend_status['sahara'] -> Class['sahara_templates::create_templates']
#}
Firewall[$firewall_rule] -> Class['sahara::api']
Service['sahara-api'] -> Haproxy_backend_status['sahara']
#########################

View File

@ -1,6 +1,7 @@
- id: sahara
type: puppet
groups: [primary-controller, controller]
condition: "settings:additional_components.sahara.value == true"
required_for: [deploy_end, controller_remaining_tasks]
requires: [openstack-network, horizon]
parameters:
@ -16,8 +17,20 @@
type: puppet
groups: [primary-controller]
required_for: [sahara]
condition: "settings:additional_components.sahara.value == true"
requires: [database]
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/sahara/db.pp
puppet_modules: /etc/puppet/modules
timeout: 1800
- id: sahara-keystone
type: puppet
groups: [primary-controller]
required_for: [sahara]
requires: [keystone]
condition: "settings:additional_components.sahara.value == true"
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/sahara/keystone.pp
puppet_modules: /etc/puppet/modules
timeout: 1800

View File

@ -20,27 +20,27 @@ class { '::sahara::db::mysql':
password => 'a_big_secret',
}
# And connect a message bus
class { '::sahara::notify::rabbitmq':
rabbit_password => 'guest',
rabbit_use_ssl => false,
}
# Then the common class
class { '::sahara':
database_connection => 'mysql://sahara:a_big_secret@127.0.0.1:3306/sahara',
verbose => true,
debug => true,
keystone_username => 'admin',
keystone_password => 'secrets_everywhere',
keystone_tenant => 'admin',
keystone_url => 'http://127.0.0.1:5000/v2.0/',
identity_url => 'http://127.0.0.1:35357/',
service_host => '0.0.0.0',
service_port => 8386,
admin_user => 'admin',
admin_password => 'secrets_everywhere',
admin_tenant_name => 'admin',
auth_uri => 'http://127.0.0.1:5000/v2.0/',
identity_uri => 'http://127.0.0.1:35357/',
use_floating_ips => true,
}
# Install API server
class { '::sahara::api':
}
# Install Engine server
class { '::sahara::engine':
}
# Finally, make it accessible
class { '::sahara::keystone::auth':
password => 'secrete',

View File

@ -0,0 +1,72 @@
# == Class: sahara::all
#
# Installs & configure the Sahara combined API & Engine service
# Deprecated since Kilo
#
# === Parameters
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to 'true'.
#
# [*host*]
# (Optional) Hostname for sahara to listen on
# Defaults to '0.0.0.0'.
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet.
# Defaults to 'true'.
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'
#
# [*port*]
# (Optional) Port for sahara to listen on
# Defaults to 8386.
#
class sahara::all (
$enabled = true,
$host = '0.0.0.0',
$manage_service = true,
$package_ensure = 'present',
$port = '8386',
) {
include ::sahara
include ::sahara::params
include ::sahara::policy
Sahara_config<||> ~> Service['sahara-all']
Class['sahara::policy'] -> Service['sahara-all']
Package<| title == 'sahara-common' |> -> Package['sahara-all']
Exec['sahara-dbmanage'] -> Service['sahara-all']
package { 'sahara-all':
ensure => $package_ensure,
name => $::sahara::params::all_package_name,
tag => 'openstack',
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
sahara_config {
'DEFAULT/host': value => $host;
'DEFAULT/port': value => $port;
}
service { 'sahara-all':
ensure => $service_ensure,
name => $::sahara::params::all_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
require => Package['sahara-all'],
}
}

View File

@ -0,0 +1,78 @@
# == Class: sahara::api
#
# Installs & configure the Sahara API service
#
# === Parameters
# [*api_workers*]
# (Optional) Number of workers for Sahara API service
# 0 means all-in-one-thread configuration
# Defaults to undef.
#
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to 'true'.
#
# [*host*]
# (Optional) Hostname for sahara to listen on
# Defaults to '0.0.0.0'.
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet.
# Defaults to 'true'.
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'
#
# [*port*]
# (Optional) Port for sahara to listen on
# Defaults to 8386.
#
class sahara::api (
$api_workers = 0,
$enabled = true,
$host = '0.0.0.0',
$manage_service = true,
$package_ensure = 'present',
$port = '8386',
) {
include ::sahara
include ::sahara::params
include ::sahara::policy
Sahara_config<||> ~> Service['sahara-api']
Package<| title == 'sahara-common' |> -> Package['sahara-api']
Exec['sahara-dbmanage'] -> Service['sahara-api']
Class['sahara::policy'] -> Service['sahara-api']
package { 'sahara-api':
ensure => $package_ensure,
name => $::sahara::params::api_package_name,
tag => 'openstack',
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
sahara_config {
'DEFAULT/api_workers': value => $api_workers;
'DEFAULT/host': value => $host;
'DEFAULT/port': value => $port;
}
service { 'sahara-api':
ensure => $service_ensure,
name => $::sahara::params::api_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
require => Package['sahara-api'],
}
}

View File

@ -0,0 +1,66 @@
# == Class: sahara::engine
#
# Installs & configure the Sahara Engine service
#
# === Parameters
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to 'true'.
#
# [*infrastructure_engine*]
# (Optional) An engine which will be used to provision
# infrastructure for Hadoop cluster.
# Can be set to 'direct' and 'heat'
# Defaults to 'direct'
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet.
# Defaults to 'true'.
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'
#
class sahara::engine (
$enabled = true,
$infrastructure_engine = 'direct',
$manage_service = true,
$package_ensure = 'present',
) {
include ::sahara
include ::sahara::params
include ::sahara::policy
Sahara_config<||> ~> Service['sahara-engine']
Package<| title == 'sahara-common' |> -> Package['sahara-engine']
Class['sahara::policy'] -> Service['sahara-engine']
package { 'sahara-engine':
ensure => $package_ensure,
name => $::sahara::params::engine_package_name,
tag => 'openstack',
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
sahara_config {
'DEFAULT/infrastructure_engine': value => $infrastructure_engine;
}
service { 'sahara-engine':
ensure => $service_ensure,
name => $::sahara::params::engine_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
require => Package['sahara-engine'],
}
}

View File

@ -8,14 +8,6 @@
# (Optional) Ensure state for package
# Defaults to 'present'.
#
# [*manage_service*]
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*enabled*]
# (optional) Should the service be enabled.
# Defaults to true.
#
# [*verbose*]
# (Optional) Should the daemons log verbose messages
# Defaults to 'false'.
@ -37,14 +29,6 @@
# If set to boolean false, it will not log to any directory.
# Defaults to '/var/log/sahara'
#
# [*service_host*]
# (Optional) Hostname for sahara to listen on
# Defaults to '0.0.0.0'.
#
# [*service_port*]
# (Optional) Port for sahara to listen on
# Defaults to 8386.
#
# [*use_neutron*]
# (Optional) Whether to use neutron
# Defaults to 'false'.
@ -53,65 +37,299 @@
# (Optional) Whether to use floating IPs to communicate with instances.
# Defaults to 'true'.
#
# [*plugins*]
# (Optional) List of plugins to be loaded.
# Sahara preserves the order of the list when returning it.
# Defaults to 'vanilla, hdp, spark, cdh'
#
# [*use_ssl*]
# (optional) Enable SSL on the API server
# Defaults to false, not set
#
# [*cert_file*]
# (optinal) Certificate file to use when starting API server securely
# Defaults to false, not set
#
# [*key_file*]
# (optional) Private key file to use when starting API server securely
# Defaults to false, not set
#
# [*ca_file*]
# (optional) CA certificate file to use to verify connecting clients
# Defaults to false, not set
#
# == database configuration options
#
# [*database_connection*]
# (Optional) Non-sqllite database for sahara
# Defaults to 'mysql://sahara:secrete@localhost:3306/sahara'
# (Optional) Non-sqllite database for sahara.
# Defaults to 'mysql://sahara:secrete@localhost:3306/sahara'.
#
# [*max_retries*]
# (Optional) Maximum number of database connection retries during startup.
# Set to -1 to specify an infinite retry count.
# Defaults to '10'.
#
# [*idle_timeout*]
# (Optional) Timeout before idle SQL connections are reaped.
# Defaults to '3600'.
#
# [*max_retries*]
# (Optional) Maximum number of database connection retries during startup.
# Set to -1 to specify an infinite retry count.
# Defaults to '10'.
#
# [*idle_timeout*]
# (Optional) Timeout before idle SQL connections are reaped.
# Defaults to '3600'.
#
# == keystone authentication options
#
# [*keystone_username*]
# (Optional) Username for sahara credentials
# [*admin_user*]
# (Optional) Service username.
# Defaults to 'admin'.
#
# [*keystone_password*]
# (Optional) Password for sahara credentials
# [*admin_password*]
# (Optional) Service user password.
# Defaults to false.
#
# [*keystone_tenant*]
# (Optional) Tenant for keystone_username
# [*admin_tenant_name*]
# (Optional) Service tenant name.
# Defaults to 'admin'.
#
# [*keystone_url*]
# (Optional) Public identity endpoint
# [*auth_uri*]
# (Optional) Complete public Identity API endpoint.
# Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*identity_url*]
# (Optional) Admin identity endpoint
# [*identity_uri*]
# (Optional) Complete admin Identity API endpoint.
# This should specify the unversioned root endpoint.
# Defaults to 'http://127.0.0.1:35357/'.
#
# == rpc backend options
#
# [*rpc_backend*]
# (optional) The rpc backend implementation to use, can be:
# rabbit (for rabbitmq)
# qpid (for qpid)
# zmq (for zeromq)
# Defaults to 'rabbit'
#
# [*rabbit_ha_queues*]
# (Optional) Use durable queues in RabbitMQ.
# Defaults to false.
#
# [*rabbit_host*]
# (Optional) IP or hostname of the rabbit server.
# Defaults to '127.0.0.1'.
#
# [*rabbit_port*]
# (Optional) Port of the rabbit server.
# Defaults to 5672.
#
# [*rabbit_hosts*]
# (Optional) IP or hostname of the rabbits servers.
# comma separated array (ex: ['1.0.0.10:5672','1.0.0.11:5672'])
# Defaults to false.
#
# [*rabbit_use_ssl*]
# (Optional) Connect over SSL for RabbitMQ.
# Defaults to false.
#
# [*rabbit_userid*]
# (Optional) User to connect to the rabbit server.
# Defaults to 'guest'.
#
# [*rabbit_password*]
# (Optional) Password to connect to the rabbit server.
# Defaults to 'guest'.
#
# [*rabbit_login_method*]
# (Optional) Method to auth with the rabbit server.
# Defaults to 'AMQPLAIN'.
#
# [*rabbit_virtual_host*]
# (Optional) Virtual host to use.
# Defaults to '/'.
#
# [*rabbit_retry_interval*]
# (Optional) Reconnection attempt frequency for rabbit.
# Defaults to 1.
#
# [*rabbit_retry_backoff*]
# (Optional) Backoff between reconnection attempts for rabbit.
# Defaults to 2.
#
# [*rabbit_max_retries*]
# (Optional) Number of times to retry (0 == no limit).
# Defaults to 0.
#
# [*qpid_hostname*]
# (Optional) IP or hostname of the qpid server.
# Defaults to '127.0.0.1'.
#
# [*qpid_port*]
# (Optional) Port of the qpid server.
# Defaults to 5672.
#
# [*qpid_hosts*]
# (Optional) Qpid HA cluster host:port pairs..
# comma separated array (ex: ['1.0.0.10:5672','1.0.0.11:5672'])
# Defaults to false.
#
# [*qpid_username*]
# (Optional) User to connect to the qpid server.
# Defaults to 'guest'.
#
# [*qpid_password*]
# (Optional) Password to connect to the qpid server.
# Defaults to 'guest'.
#
# [*qpid_sasl_mechanisms*]
# (Optional) String of SASL mechanisms to use.
# Defaults to ''.
#
# [*qpid_heartbeat*]
# (Optional) Seconds between connection keepalive heartbeats.
# Defaults to 60.
#
# [*qpid_protocol*]
# (Optional) Protocol to use for qpid (tcp/ssl).
# Defaults to tcp.
#
# [*qpid_tcp_nodelay*]
# (Optional) Whether to disable the Nagle algorithm.
# Defaults to true.
#
# [*qpid_receiver_capacity*]
# (Optional) Number of prefetched messages to hold.
# Defaults to 1.
#
# [*qpid_topology_version*]
# (Optional) Version of qpid toplogy to use.
# Defaults to 2.
#
# [*zeromq_bind_address*]
# (Optional) Bind address; wildcard, ethernet, or ip address.
# Defaults to '*'.
#
# [*zeromq_port*]
# (Optional) Receiver listening port.
# Defaults to 9501.
#
# [*zeromq_contexts*]
# (Optional) Number of contexsts for zeromq.
# Defaults to 1.
#
# [*zeromq_topic_backlog*]
# (Optional) Number of incoming messages to buffer.
# Defaults to 'None'.
#
# [*zeromq_ipc_dir*]
# (Optional) Directory for zeromq IPC.
# Defaults to '/var/run/openstack'.
#
# [*zeromq_host*]
# (Optional) Name of the current node: hostname, FQDN, or IP.
# Defaults to 'sahara'.
#
# [*cast_timeout*]
# (Optional) TTL for zeromq messages.
# Defaults to 30.
#
# [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions.
# Defaults to 'TLSv1'
#
# [*kombu_ssl_keyfile*]
# (Optional) SSL key file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_ssl_certfile*]
# (Optional) SSL cert file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_ssl_ca_certs*]
# (Optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef
#
# [*kombu_reconnect_delay*]
# (Optional) Backoff on cancel notification (valid only if SSL enabled).
# Defaults to '1.0'; floating-point value.
#
class sahara(
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$verbose = false,
$debug = false,
$use_syslog = false,
$log_facility = 'LOG_USER',
$log_dir = '/var/log/sahara',
$service_host = '0.0.0.0',
$service_port = 8386,
$use_neutron = false,
$use_floating_ips = true,
$plugins = ['vanilla' , 'hdp', 'spark', 'cdh'],
$use_ssl = false,
$ca_file = false,
$cert_file = false,
$key_file = false,
$database_connection = 'mysql://sahara:secrete@localhost:3306/sahara',
$keystone_username = 'admin',
$keystone_password = false,
$keystone_tenant = 'admin',
$keystone_url = 'http://127.0.0.1:5000/v2.0/',
$identity_url = 'http://127.0.0.1:35357/',
$max_retries = '10',
$idle_timeout = '3600',
$admin_user = 'admin',
$admin_password = false,
$admin_tenant_name = 'admin',
$auth_uri = 'http://127.0.0.1:5000/v2.0/',
$identity_uri = 'http://127.0.0.1:35357/',
$rpc_backend = 'rabbit',
$rabbit_ha_queues = false,
$rabbit_host = 'localhost',
$rabbit_hosts = false,
$rabbit_port = 5672,
$rabbit_use_ssl = false,
$rabbit_userid = 'guest',
$rabbit_password = 'guest',
$rabbit_login_method = 'AMQPLAIN',
$rabbit_virtual_host = '/',
$rabbit_retry_interval = 1,
$rabbit_retry_backoff = 2,
$rabbit_max_retries = 0,
$qpid_hostname = 'localhost',
$qpid_port = 5672,
$qpid_hosts = false,
$qpid_username = 'guest',
$qpid_password = 'guest',
$qpid_sasl_mechanisms = '',
$qpid_heartbeat = 60,
$qpid_protocol = 'tcp',
$qpid_tcp_nodelay = true,
$qpid_receiver_capacity = 1,
$qpid_topology_version = 2,
$zeromq_bind_address = '*',
$zeromq_port = 9501,
$zeromq_contexts = 1,
$zeromq_topic_backlog = 'None',
$zeromq_ipc_dir = '/var/run/openstack',
$zeromq_host = 'sahara',
$cast_timeout = 30,
$kombu_ssl_version = 'TLSv1',
$kombu_ssl_keyfile = undef,
$kombu_ssl_certfile = undef,
$kombu_ssl_ca_certs = undef,
$kombu_reconnect_delay = '1.0',
) {
include ::sahara::params
include ::sahara::policy
if $::osfamily == 'RedHat' {
$group_require = Package['sahara']
$dir_require = Package['sahara']
$conf_require = Package['sahara']
$group_require = Package['sahara-common']
$dir_require = Package['sahara-common']
$conf_require = Package['sahara-common']
} else {
# TO-DO(mmagr): This hack has to be removed as soon as following bug
# is fixed. On Ubuntu sahara-trove is not installable because it needs
# running database and prefilled sahara.conf in order to install package:
# https://bugs.launchpad.net/ubuntu/+source/sahara/+bug/1452698
Sahara_config<| |> -> Package['sahara']
Sahara_config<| |> -> Package['sahara-common']
$group_require = undef
$dir_require = Group['sahara']
@ -146,9 +364,9 @@ class sahara(
selinux_ignore_defaults => true
}
package { 'sahara':
package { 'sahara-common':
ensure => $package_ensure,
name => $::sahara::params::package_name,
name => $::sahara::params::common_package_name,
tag => 'openstack',
}
@ -160,12 +378,9 @@ class sahara(
# https://bugs.launchpad.net/cloud-archive/+bug/1450945
File['/etc/sahara/sahara.conf'] -> Sahara_config<| |>
Package['sahara'] -> Class['sahara::policy']
Package['sahara-common'] -> Class['sahara::policy']
Package['sahara'] ~> Service['sahara']
Class['sahara::policy'] ~> Service['sahara']
validate_re($database_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
validate_re($database_connection, '(mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
case $database_connection {
/^mysql:\/\//: {
@ -175,39 +390,141 @@ class sahara(
/^postgresql:\/\//: {
require postgresql::lib::python
}
/^sqlite:\/\//: {
fail('Sahara does not support sqlite!')
}
default: {
fail('Unsupported db backend configured')
}
}
sahara_config {
'DEFAULT/use_neutron': value => $use_neutron;
'DEFAULT/use_floating_ips': value => $use_floating_ips;
'DEFAULT/host': value => $service_host;
'DEFAULT/port': value => $service_port;
'DEFAULT/debug': value => $debug;
'DEFAULT/verbose': value => $verbose;
'database/connection':
value => $database_connection,
secret => true;
'database/max_retries' : value => $max_retries;
'database/idle_timeout': value => $idle_timeout;
}
if $keystone_password {
sahara_config {
'DEFAULT/debug': value => $debug;
'DEFAULT/plugins': value => join($plugins,',');
'DEFAULT/use_neutron': value => $use_neutron;
'DEFAULT/use_floating_ips': value => $use_floating_ips;
'DEFAULT/verbose': value => $verbose;
}
if $admin_password {
sahara_config {
'keystone_authtoken/auth_uri': value => $keystone_url;
'keystone_authtoken/identity_uri': value => $identity_url;
'keystone_authtoken/admin_user': value => $keystone_username;
'keystone_authtoken/admin_tenant_name': value => $keystone_tenant;
'keystone_authtoken/auth_uri': value => $auth_uri;
'keystone_authtoken/identity_uri': value => $identity_uri;
'keystone_authtoken/admin_user': value => $admin_user;
'keystone_authtoken/admin_tenant_name': value => $admin_tenant_name;
'keystone_authtoken/admin_password':
value => $keystone_password,
value => $admin_password,
secret => true;
}
}
if $rpc_backend == 'rabbit' {
if $rabbit_use_ssl {
if $kombu_ssl_ca_certs {
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; }
} else {
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; }
}
if $kombu_ssl_certfile or $kombu_ssl_keyfile {
sahara_config {
'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile;
'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
}
} else {
sahara_config {
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
}
}
if $kombu_ssl_version {
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; }
} else {
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
}
} else {
sahara_config {
'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
}
}
if $rabbit_hosts {
sahara_config {
'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',');
'oslo_messaging_rabbit/rabbit_ha_queues': value => true;
}
} else {
sahara_config {
'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host;
'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port;
'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues;
'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}";
}
}
sahara_config {
'DEFAULT/rpc_backend': value => 'rabbit';
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_password':
value => $rabbit_password,
secret => true;
'oslo_messaging_rabbit/rabbit_login_method': value => $rabbit_login_method;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_retry_interval': value => $rabbit_retry_interval;
'oslo_messaging_rabbit/rabbit_retry_backoff': value => $rabbit_retry_backoff;
'oslo_messaging_rabbit/rabbit_max_retries': value => $rabbit_max_retries;
'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay;
}
}
if $rpc_backend == 'qpid' {
if $qpid_hosts {
sahara_config {
'oslo_messaging_qpid/qpid_hosts': value => join($qpid_hosts, ',');
}
} else {
sahara_config {
'oslo_messaging_qpid/qpid_hostname': value => $qpid_hostname;
'oslo_messaging_qpid/qpid_port': value => $qpid_port;
'oslo_messaging_qpid/qpid_hosts': value => "${qpid_hostname}:${qpid_port}";
}
}
sahara_config {
'DEFAULT/rpc_backend': value => 'qpid';
'oslo_messaging_qpid/qpid_username': value => $qpid_username;
'oslo_messaging_qpid/qpid_password':
value => $qpid_password,
secret => true;
'oslo_messaging_qpid/qpid_sasl_mechanisms': value => $qpid_sasl_mechanisms;
'oslo_messaging_qpid/qpid_heartbeat': value => $qpid_heartbeat;
'oslo_messaging_qpid/qpid_protocol': value => $qpid_protocol;
'oslo_messaging_qpid/qpid_tcp_nodelay': value => $qpid_tcp_nodelay;
'oslo_messaging_qpid/qpid_receiver_capacity': value => $qpid_receiver_capacity;
'oslo_messaging_qpid/qpid_topology_version': value => $qpid_topology_version;
}
}
if $rpc_backend == 'zmq' {
sahara_config {
'DEFAULT/rpc_backend': value => 'zmq';
'DEFAULT/rpc_zmq_bind_address': value => $zeromq_bind_address;
'DEFAULT/rpc_zmq_port': value => $zeromq_port;
'DEFAULT/rpc_zmq_contexts': value => $zeromq_contexts;
'DEFAULT/rpc_zmq_topic_backlog': value => $zeromq_topic_backlog;
'DEFAULT/rpc_zmq_ipc_dir': value => $zeromq_ipc_dir;
'DEFAULT/rpc_zmq_host': value => $zeromq_host;
'DEFAULT/rpc_cast_timeout': value => $cast_timeout;
}
}
if $log_dir {
sahara_config {
'DEFAULT/log_dir': value => $log_dir;
@ -220,30 +537,36 @@ class sahara(
if $use_syslog {
sahara_config {
'DEFAULT/use_syslog': value => true;
'DEFAULT/syslog_log_facility': value => $log_facility;
'DEFAULT/use_syslog': value => true;
'DEFAULT/syslog_log_facility': value => $log_facility;
}
} else {
sahara_config {
'DEFAULT/use_syslog': value => false;
'DEFAULT/use_syslog': value => false;
}
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
if $use_ssl {
if !$ca_file {
fail('The ca_file parameter is required when use_ssl is set to true')
}
if !$cert_file {
fail('The cert_file parameter is required when use_ssl is set to true')
}
if !$key_file {
fail('The key_file parameter is required when use_ssl is set to true')
}
sahara_config {
'ssl/cert_file' : value => $cert_file;
'ssl/key_file' : value => $key_file;
'ssl/ca_file' : value => $ca_file;
}
} else {
sahara_config {
'ssl/cert_file' : ensure => absent;
'ssl/key_file' : ensure => absent;
'ssl/ca_file' : ensure => absent;
}
}
service { 'sahara':
ensure => $service_ensure,
name => $::sahara::params::service_name,
hasstatus => true,
enable => $enabled,
hasrestart => true,
subscribe => Exec['sahara-dbmanage'],
}
exec { 'sahara-dbmanage':
@ -251,7 +574,7 @@ class sahara(
path => '/usr/bin',
user => 'sahara',
refreshonly => true,
subscribe => [Package['sahara'], Sahara_config['database/connection']],
subscribe => [Package['sahara-common'], Sahara_config['database/connection']],
logoutput => on_failure,
}

View File

@ -0,0 +1,46 @@
# == Class: sahara::notify
#
# Ceilometer notifications configuration for Sahara
#
# === Parameters
#
# [*control_exchange*]
# (Optional) The default exchange to scope topics.
# Defaults to 'openstack'.
#
# [*enable_notifications*]
# (Optional) Enables sending notifications to Ceilometer.
# Defaults to false.
#
# [*notification_driver*]
# (Optional) Notification driver to use.
# Defaults to 'messaging'.
#
# [*notification_topics*]
# (Optional) Topic to use for notifications.
# Defaults to 'notifications'.
#
# [*notification_level*]
# (Optional) Notification level for outgoing notifications.
# Defaults to 'INFO'.
#
class sahara::notify (
$control_exchange = 'openstack',
$enable_notifications = false,
$notification_driver = 'messaging',
$notification_topics = 'notifications',
$notification_level = 'INFO',
) {
if $enable_notifications {
sahara_config {
'DEFAULT/control_exchange': value => $control_exchange;
'DEFAULT/enable_notifications': value => $enable_notifications;
'DEFAULT/notification_driver': value => $notification_driver;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/notification_level': value => $notification_level;
}
}
}

View File

@ -1,6 +1,7 @@
# == Class: sahara::notify::qpid
#
# Qpid broker configuration for Sahara
# Deprecated class
#
# === Parameters
#
@ -56,28 +57,6 @@
# (Optional) The default exchange to scope topics.
# Defaults to 'openstack'.
#
# [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions.
# Defaults to 'TLSv1'
#
# [*kombu_ssl_keyfile*]
# (Optional) SSL key file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_ssl_certfile*]
# (Optional) SSL cert file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_reconnect_delay*]
# (Optional) Backoff on cancel notification (valid only if SSL enabled).
# Defaults to '1.0'; floating-point value.
#
class sahara::notify::qpid(
$durable_queues = false,
$qpid_hostname = 'localhost',
@ -92,59 +71,29 @@ class sahara::notify::qpid(
$qpid_topology_version = 2,
$notification_topics = 'notifications',
$control_exchange = 'openstack',
$kombu_ssl_version = 'TLSv1',
$kombu_ssl_keyfile = undef,
$kombu_ssl_certfile = undef,
$kombu_ssl_ca_certs = undef,
$kombu_reconnect_delay = '1.0',
) {
if $qpid_protocol == 'ssl' {
if !$kombu_ssl_keyfile {
fail('kombu_ssl_keyfile must be set when using SSL in qpid')
}
if !$kombu_ssl_certfile {
fail('kombu_ssl_certfile must be set when using SSL in qpid')
}
if !$kombu_ssl_ca_certs {
fail('kombu_ca_certs must be set when using SSL in qpid')
}
sahara_config {
'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version;
'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile;
'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs;
'DEFAULT/kombu_reconnect_delay': value => $kombu_reconnect_delay;
}
} elsif $qpid_protocol == 'tcp' {
sahara_config {
'DEFAULT/kombu_ssl_version': ensure => absent;
'DEFAULT/kombu_ssl_keyfile': ensure => absent;
'DEFAULT/kombu_ssl_certfile': ensure => absent;
'DEFAULT/kombu_ssl_ca_certs': ensure => absent;
'DEFAULT/kombu_reconnect_delay': ensure => absent;
}
} else {
fail("valid qpid_protocol settings are 'tcp' and 'ssl' only")
}
warning('This class is deprecated. Use sahara::init for configuration rpc options instead')
warning('This class is deprecated. Use sahara::notify for configuration ceilometer notifications instead')
sahara_config {
'DEFAULT/rpc_backend': value => 'qpid';
'DEFAULT/qpid_hosts': value => '$qpid_hostname:$qpid_port';
'DEFAULT/rpc_backend': value => 'qpid';
'oslo_messaging_qpid/qpid_hosts': value => '$qpid_hostname:$qpid_port';
'DEFAULT/amqp_durable_queues': value => $durable_queues;
'DEFAULT/qpid_hostname': value => $qpid_hostname;
'DEFAULT/qpid_port': value => $qpid_port;
'DEFAULT/qpid_username': value => $qpid_username;
'DEFAULT/qpid_password':
'oslo_messaging_qpid/amqp_durable_queues': value => $durable_queues;
'oslo_messaging_qpid/qpid_hostname': value => $qpid_hostname;
'oslo_messaging_qpid/qpid_port': value => $qpid_port;
'oslo_messaging_qpid/qpid_username': value => $qpid_username;
'oslo_messaging_qpid/qpid_password':
value => $qpid_password,
secret => true;
'DEFAULT/qpid_sasl_mechanisms': value => $qpid_sasl_mechanisms;
'DEFAULT/qpid_heartbeat': value => $qpid_heartbeat;
'DEFAULT/qpid_protocol': value => $qpid_protocol;
'DEFAULT/qpid_tcp_nodelay': value => $qpid_tcp_nodelay;
'DEFAULT/qpid_receiver_capacity': value => $qpid_receiver_capacity;
'DEFAULT/qpid_topology_version': value => $qpid_topology_version;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/control_exchange': value => $control_exchange;
'oslo_messaging_qpid/qpid_sasl_mechanisms': value => $qpid_sasl_mechanisms;
'oslo_messaging_qpid/qpid_heartbeat': value => $qpid_heartbeat;
'oslo_messaging_qpid/qpid_protocol': value => $qpid_protocol;
'oslo_messaging_qpid/qpid_tcp_nodelay': value => $qpid_tcp_nodelay;
'oslo_messaging_qpid/qpid_receiver_capacity': value => $qpid_receiver_capacity;
'oslo_messaging_qpid/qpid_topology_version': value => $qpid_topology_version;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/control_exchange': value => $control_exchange;
}
}

View File

@ -1,6 +1,7 @@
# == Class: sahara::notify::rabbitmq
#
# RabbitMQ broker configuration for Sahara
# Deprecated class
#
# === Parameters
#
@ -104,6 +105,10 @@ class sahara::notify::rabbitmq(
$kombu_ssl_ca_certs = undef,
$kombu_reconnect_delay = '1.0',
) {
warning('This class is deprecated. Use sahara::init for configuration rpc options instead')
warning('This class is deprecated. Use sahara::notify for configuration ceilometer notifications instead')
if $rabbit_use_ssl {
if $kombu_ssl_ca_certs {
@ -125,9 +130,9 @@ class sahara::notify::rabbitmq(
}
if $kombu_ssl_version {
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; }
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; }
} else {
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
sahara_config { 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; }
}
} else {
@ -154,20 +159,20 @@ class sahara::notify::rabbitmq(
}
sahara_config {
'oslo_messaging_rabbit/rpc_backend': value => 'rabbit';
'DEFAULT/amqp_durable_queues': value => $durable_queues;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'DEFAULT/rpc_backend': value => 'rabbit';
'oslo_messaging_rabbit/amqp_durable_queues': value => $durable_queues;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_password':
value => $rabbit_password,
secret => true;
'oslo_messaging_rabbit/rabbit_login_method': value => $rabbit_login_method;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_login_method': value => $rabbit_login_method;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_retry_interval': value => $rabbit_retry_interval;
'oslo_messaging_rabbit/rabbit_retry_backoff': value => $rabbit_retry_backoff;
'oslo_messaging_rabbit/rabbit_max_retries': value => $rabbit_max_retries;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/control_exchange': value => $control_exchange;
'oslo_messaging_rabbit/rabbit_retry_backoff': value => $rabbit_retry_backoff;
'oslo_messaging_rabbit/rabbit_max_retries': value => $rabbit_max_retries;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/control_exchange': value => $control_exchange;
'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay;
}
}

View File

@ -1,6 +1,7 @@
# == Class: sahara::notify::zeromq
#
# Zeromq broker configuration for Sahara
# Deprecated class
#
# === Parameters
#
@ -32,28 +33,6 @@
# (Optional) TTL for zeromq messages.
# Defaults to 30.
#
# [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions.
# Defaults to 'TLSv1'
#
# [*kombu_ssl_keyfile*]
# (Optional) SSL key file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_ssl_certfile*]
# (Optional) SSL cert file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef.
#
# [*kombu_reconnect_delay*]
# (Optional) Backoff on cancel notification (valid only if SSL enabled).
# Defaults to '1.0'; floating-point value.
#
class sahara::notify::zeromq(
$zeromq_bind_address = '*',
$zeromq_port = 9501,
@ -62,47 +41,18 @@ class sahara::notify::zeromq(
$zeromq_ipc_dir = '/var/run/openstack',
$zeromq_host = 'sahara',
$cast_timeout = 30,
$kombu_ssl_version = 'TLSv1',
$kombu_ssl_keyfile = undef,
$kombu_ssl_certfile = undef,
$kombu_ssl_ca_certs = undef,
$kombu_reconnect_delay = '1.0',
) {
if $kombu_ssl_keyfile or $kombu_ssl_certfile or $kombu_ssl_ca_certs {
if !$kombu_ssl_keyfile {
fail('kombu_ssl_keyfile must be set when using SSL in zeromq')
}
if !$kombu_ssl_certfile {
fail('kombu_ssl_certfile must be set when using SSL in zeromq')
}
if !$kombu_ssl_ca_certs {
fail('kombu_ca_certs must be set when using SSL in zeromq')
}
sahara_config {
'DEFAULT/kombu_ssl_version': value => $kombu_ssl_version;
'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile;
'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs;
'DEFAULT/kombu_reconnect_delay': value => $kombu_reconnect_delay;
}
} else {
sahara_config {
'DEFAULT/kombu_ssl_version': ensure => absent;
'DEFAULT/kombu_ssl_keyfile': ensure => absent;
'DEFAULT/kombu_ssl_certfile': ensure => absent;
'DEFAULT/kombu_ssl_ca_certs': ensure => absent;
'DEFAULT/kombu_reconnect_delay': ensure => absent;
}
}
warning('This class is deprecated. Use sahara::init for configuration rpc options instead')
sahara_config {
'DEFAULT/rpc_backend': value => 'zmq';
'DEFAULT/rpc_zmq_bind_address': value => $zeromq_bind_address;
'DEFAULT/rpc_zmq_port': value => $zeromq_port;
'DEFAULT/rpc_zmq_contexts': value => $zeromq_contexts;
'DEFAULT/rpc_backend': value => 'zmq';
'DEFAULT/rpc_zmq_bind_address': value => $zeromq_bind_address;
'DEFAULT/rpc_zmq_port': value => $zeromq_port;
'DEFAULT/rpc_zmq_contexts': value => $zeromq_contexts;
'DEFAULT/rpc_zmq_topic_backlog': value => $zeromq_topic_backlog;
'DEFAULT/rpc_zmq_ipc_dir': value => $zeromq_ipc_dir;
'DEFAULT/rpc_zmq_host': value => $zeromq_host;
'DEFAULT/rpc_cast_timeout': value => $cast_timeout;
'DEFAULT/rpc_zmq_ipc_dir': value => $zeromq_ipc_dir;
'DEFAULT/rpc_zmq_host': value => $zeromq_host;
'DEFAULT/rpc_cast_timeout': value => $cast_timeout;
}
}

View File

@ -8,12 +8,22 @@ class sahara::params {
case $::osfamily {
'RedHat': {
$package_name = 'openstack-sahara'
$service_name = 'openstack-sahara-all'
$common_package_name = 'openstack-sahara-common'
$all_package_name = 'openstack-sahara'
$api_package_name = 'openstack-sahara-api'
$engine_package_name = 'openstack-sahara-engine'
$all_service_name = 'openstack-sahara-all'
$api_service_name = 'openstack-sahara-api'
$engine_service_name = 'openstack-sahara-engine'
}
'Debian': {
$package_name = 'sahara'
$service_name = 'sahara'
$common_package_name = 'sahara-common'
$all_package_name = 'sahara'
$api_package_name = 'sahara-api'
$engine_package_name = 'sahara-engine'
$all_service_name = 'sahara'
$api_service_name = 'sahara-api'
$engine_service_name = 'sahara-engine'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}")

View File

@ -76,23 +76,27 @@ describe 'basic sahara' do
public_url => "https://${::fqdn}:5000/",
admin_url => "https://${::fqdn}:35357/",
}
# Sahara resources
class { '::sahara':
database_connection => 'mysql://sahara:a_big_secret@127.0.0.1/sahara?charset=utf8',
keystone_password => 'a_big_secret',
}
class { '::sahara::db::mysql':
password => 'a_big_secret',
}
# Sahara resources
class { '::sahara':
rabbit_userid => 'sahara',
rabbit_password => 'an_even_bigger_secret',
rabbit_host => '127.0.0.1',
database_connection => 'mysql://sahara:a_big_secret@127.0.0.1/sahara?charset=utf8',
admin_password => 'a_big_secret',
}
class { '::sahara::api':
}
class { '::sahara::engine':
}
class { '::sahara::keystone::auth':
password => 'a_big_secret',
}
class { '::sahara::client': }
class { '::sahara::notify::rabbitmq':
rabbit_userid => 'sahara',
rabbit_password => 'an_even_bigger_secret',
rabbit_host => '127.0.0.1',
class { '::sahara::notify':
enable_notifications => true,
}
EOS

View File

@ -0,0 +1,101 @@
require 'spec_helper'
describe 'sahara::all' do
let :params do
{ :enabled => true,
:manage_service => true }
end
shared_examples_for 'sahara-all' do
context 'config params' do
it { is_expected.to contain_class('sahara') }
it { is_expected.to contain_class('sahara::params') }
it { is_expected.to contain_class('sahara::policy') }
it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('0.0.0.0') }
it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('8386') }
end
context 'passing params' do
let :params do
{
:host => 'localhost',
:port => '8387',
}
end
it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('localhost') }
it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('8387') }
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
before do
params.merge!(param_hash)
end
it 'configures sahara-all service' do
is_expected.to contain_service('sahara-all').with(
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:all_service_name],
:enable => params[:enabled],
:hasstatus => true,
:hasrestart => true,
:require => 'Package[sahara-all]'
)
end
end
end
context 'with disabled service managing' do
before do
params.merge!({
:manage_service => false,
:enabled => false })
end
it 'configures sahara-all service' do
is_expected.to contain_service('sahara-all').with(
:ensure => nil,
:name => platform_params[:all_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:require => 'Package[sahara-all]'
)
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :all_service_name => 'sahara' }
end
it_configures 'sahara-all'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
let :platform_params do
{ :all_service_name => 'openstack-sahara-all' }
end
it_configures 'sahara-all'
end
end

View File

@ -0,0 +1,105 @@
require 'spec_helper'
describe 'sahara::api' do
let :params do
{ :enabled => true,
:manage_service => true,
:api_workers => '0' }
end
shared_examples_for 'sahara-api' do
context 'config params' do
it { is_expected.to contain_class('sahara') }
it { is_expected.to contain_class('sahara::params') }
it { is_expected.to contain_class('sahara::policy') }
it { is_expected.to contain_sahara_config('DEFAULT/api_workers').with_value('0') }
it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('0.0.0.0') }
it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('8386') }
end
context 'passing params' do
let :params do
{
:api_workers => '2',
:host => 'localhost',
:port => '8387',
}
end
it { is_expected.to contain_sahara_config('DEFAULT/api_workers').with_value('2') }
it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('localhost') }
it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('8387') }
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
before do
params.merge!(param_hash)
end
it 'configures sahara-api service' do
is_expected.to contain_service('sahara-api').with(
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:api_service_name],
:enable => params[:enabled],
:hasstatus => true,
:hasrestart => true,
:require => 'Package[sahara-api]'
)
end
end
end
context 'with disabled service managing' do
before do
params.merge!({
:manage_service => false,
:enabled => false })
end
it 'configures sahara-api service' do
is_expected.to contain_service('sahara-api').with(
:ensure => nil,
:name => platform_params[:api_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:require => 'Package[sahara-api]'
)
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :api_service_name => 'sahara-api' }
end
it_configures 'sahara-api'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
let :platform_params do
{ :api_service_name => 'openstack-sahara-api' }
end
it_configures 'sahara-api'
end
end

View File

@ -0,0 +1,105 @@
require 'spec_helper'
describe 'sahara::engine' do
let :params do
{ :enabled => true,
:manage_service => true,
:infrastructure_engine => 'direct' }
end
shared_examples_for 'sahara-engine' do
context 'config params' do
it { is_expected.to contain_class('sahara') }
it { is_expected.to contain_class('sahara::params') }
it { is_expected.to contain_class('sahara::policy') }
it { is_expected.to contain_sahara_config('DEFAULT/infrastructure_engine').with_value('direct') }
end
context 'with heat engine' do
let :params do
{ :enabled => true,
:manage_service => true,
:infrastructure_engine => 'heat' }
end
it { is_expected.to contain_class('sahara') }
it { is_expected.to contain_class('sahara::params') }
it { is_expected.to contain_class('sahara::policy') }
it { is_expected.to contain_sahara_config('DEFAULT/infrastructure_engine').with_value('heat') }
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
before do
params.merge!(param_hash)
end
it 'configures sahara-engine service' do
is_expected.to contain_service('sahara-engine').with(
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:engine_service_name],
:enable => params[:enabled],
:hasstatus => true,
:hasrestart => true,
:require => 'Package[sahara-engine]'
)
end
end
end
context 'with disabled service managing' do
before do
params.merge!({
:manage_service => false,
:enabled => false })
end
it 'configures sahara-engine service' do
is_expected.to contain_service('sahara-engine').with(
:ensure => nil,
:name => platform_params[:engine_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:require => 'Package[sahara-engine]'
)
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :engine_service_name => 'sahara-engine' }
end
it_configures 'sahara-engine'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
let :platform_params do
{ :engine_service_name => 'openstack-sahara-engine' }
end
it_configures 'sahara-engine'
end
end

View File

@ -7,7 +7,7 @@ describe 'sahara' do
let :params do
{
:keystone_password => 'secrete'
:admin_password => 'secrete'
}
end
@ -18,6 +18,223 @@ describe 'sahara' do
it { is_expected.to contain_exec('sahara-dbmanage') }
end
shared_examples_for 'sahara main params' do
context 'with default params' do
it { is_expected.to contain_sahara_config('DEFAULT/use_neutron').with_value('false') }
it { is_expected.to contain_sahara_config('DEFAULT/use_floating_ips').with_value('true') }
it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('vanilla,hdp,spark,cdh') }
end
context 'with passing params' do
let :params do
{
:use_neutron => 'true',
:use_floating_ips => 'false',
:plugins => ['vanilla' , 'hdp'],
}
end
it { is_expected.to contain_sahara_config('DEFAULT/use_neutron').with_value('true') }
it { is_expected.to contain_sahara_config('DEFAULT/use_floating_ips').with_value('false') }
it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('vanilla,hdp') }
end
end
shared_examples_for 'sahara rpc_backend' do
context 'with rabbit rpc' do
it { is_expected.to contain_sahara_config('DEFAULT/rpc_backend').with_value('rabbit') }
context 'when defaults with rabbit pass specified' do
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value('guest').with_secret(true) }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') }
end
context 'when passing params' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest2',
:rabbit_host => 'localhost2',
:rabbit_port => '5673',
:rabbit_ha_queues => 'true',
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value('pass').with_secret(true) }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
end
context 'with rabbit ssl cert parameters' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_use_ssl => 'true',
:kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_certfile => '/etc/certfile',
:kombu_ssl_keyfile => '/etc/key',
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/etc/ca.cert') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/etc/certfile') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/etc/key') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
end
context 'with rabbit ssl cert parameters' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_use_ssl => 'true',
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
end
context 'with rabbit ssl disabled' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_use_ssl => false,
:kombu_ssl_ca_certs => 'undef',
:kombu_ssl_certfile => 'undef',
:kombu_ssl_keyfile => 'undef'
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') }
end
context 'when passing params for single rabbit host' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest2',
:rabbit_host => 'localhost2',
:rabbit_port => '5673',
:rabbit_ha_queues => true,
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
end
context 'when passing params for multiple rabbit hosts' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest3',
:rabbit_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673']
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest3') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value(
'nonlocalhost3:5673,nonlocalhost4:5673') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
it { is_expected.to_not contain_sahara_config('oslo_messaging_rabbit/rabbit_port') }
it { is_expected.to_not contain_sahara_config('oslo_messaging_rabbit/rabbit_host') }
end
end
context 'with qpid rpc' do
let :params do
{:rpc_backend => 'qpid' }
end
it { is_expected.to contain_sahara_config('DEFAULT/rpc_backend').with_value('qpid') }
context 'when default params' do
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value('guest').with_secret(true) }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hosts').with_value('localhost:5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') }
end
context 'when passing params' do
let :params do
{
:qpid_password => 'pass',
:qpid_username => 'guest2',
:qpid_hostname => 'localhost2',
:qpid_port => '5673',
:rpc_backend => 'qpid',
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest2') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value('pass').with_secret(true) }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost2') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5673') }
end
context 'when passing params for multiple qpid hosts' do
let :params do
{
:qpid_hosts => ['nonlocalhost3:5673', 'nonlocalhost4:5673'],
:rpc_backend => 'qpid',
}
end
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hosts').with_value('nonlocalhost3:5673,nonlocalhost4:5673') }
it { is_expected.to_not contain_sahara_config('oslo_messaging_qpid/qpid_port') }
it { is_expected.to_not contain_sahara_config('oslo_messaging_qpid/qpid_hostname') }
end
end
context 'with zmq rpc' do
let :params do
{:rpc_backend => 'zmq' }
end
it { is_expected.to contain_sahara_config('DEFAULT/rpc_backend').with_value('zmq') }
context 'with default params' do
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_bind_address').with_value('*') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_port').with_value('9501') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_contexts').with_value('1') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_topic_backlog').with_value('None') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_ipc_dir').with_value('/var/run/openstack') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_host').with_value('sahara') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_cast_timeout').with_value('30') }
end
context 'when passing params' do
let :params do
{
:zeromq_bind_address => '*',
:zeromq_port => '9501',
:zeromq_host => 'localhost',
:cast_timeout => '30',
:rpc_backend => 'zmq',
}
end
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_bind_address').with_value('*') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_port').with_value('9501') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_host').with_value('localhost') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_cast_timeout').with_value('30') }
end
end
end
shared_examples_for 'sahara logging' do
context 'with syslog disabled' do
it { is_expected.to contain_sahara_config('DEFAULT/use_syslog').with_value(false) }
@ -53,6 +270,28 @@ describe 'sahara' do
end
shared_examples_for 'sahara ssl' do
context 'without ssl' do
it { is_expected.to contain_sahara_config('ssl/ca_file').with_ensure('absent') }
it { is_expected.to contain_sahara_config('ssl/cert_file').with_ensure('absent') }
it { is_expected.to contain_sahara_config('ssl/key_file').with_ensure('absent') }
end
context 'with ssl' do
let :params do
{
:use_ssl => 'true',
:ca_file => '/tmp/ca_file',
:cert_file => '/tmp/cert_file',
:key_file => '/tmp/key_file',
}
end
it { is_expected.to contain_sahara_config('ssl/ca_file').with_value('/tmp/ca_file') }
it { is_expected.to contain_sahara_config('ssl/cert_file').with_value('/tmp/cert_file') }
it { is_expected.to contain_sahara_config('ssl/key_file').with_value('/tmp/key_file') }
end
end
context 'on Debian platforms' do
let :facts do
{
@ -61,13 +300,15 @@ describe 'sahara' do
}
end
it_configures 'sahara'
it_configures 'sahara logging'
let :platform_params do
{ :common_package_name => 'sahara-common' }
end
it_behaves_like 'generic sahara service', {
:name => 'sahara',
:package_name => 'sahara',
:service_name => 'sahara' }
it_configures 'sahara'
it_configures 'sahara main params'
it_configures 'sahara logging'
it_configures 'sahara ssl'
it_configures 'sahara rpc_backend'
end
context 'on RedHat platforms' do
@ -75,13 +316,14 @@ describe 'sahara' do
{ :osfamily => 'RedHat' }
end
let :platform_params do
{ :common_package_name => 'openstack-sahara-common' }
end
it_configures 'sahara'
it_configures 'sahara main params'
it_configures 'sahara logging'
it_behaves_like 'generic sahara service', {
:name => 'sahara',
:package_name => 'openstack-sahara',
:service_name => 'openstack-sahara-all' }
it_configures 'sahara ssl'
it_configures 'sahara rpc_backend'
end
end

View File

@ -11,12 +11,12 @@ describe 'sahara::notify::qpid' do
{:qpid_password => 'pass'}
end
it { is_expected.to contain_sahara_config('DEFAULT/qpid_username').with_value('guest') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_password').with_value('pass') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_password').with_value(params[:qpid_password]).with_secret(true) }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_port').with_value('5672') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value('pass') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value(params[:qpid_password]).with_secret(true) }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') }
end
describe 'when passing params' do
@ -28,10 +28,10 @@ describe 'sahara::notify::qpid' do
:qpid_port => '5673'
}
end
it { is_expected.to contain_sahara_config('DEFAULT/qpid_username').with_value('guest2') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_hostname').with_value('localhost2') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_port').with_value('5673') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest2') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost2') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5673') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') }
end
describe 'when configuring with ssl' do
@ -42,17 +42,11 @@ describe 'sahara::notify::qpid' do
:qpid_hostname => 'localhost3',
:qpid_port => '5671',
:qpid_protocol => 'ssl',
:kombu_ssl_keyfile => '/srv/sahara_ssl.key',
:kombu_ssl_certfile => '/srv/sahara_ssl.crt',
:kombu_ssl_ca_certs => '/srv/cacert',
}
end
it { is_expected.to contain_sahara_config('DEFAULT/qpid_username').with_value('guest3') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_hostname').with_value('localhost3') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_port').with_value('5671') }
it { is_expected.to contain_sahara_config('DEFAULT/qpid_protocol').with_value('ssl') }
it { is_expected.to contain_sahara_config('DEFAULT/kombu_ssl_keyfile').with_value('/srv/sahara_ssl.key') }
it { is_expected.to contain_sahara_config('DEFAULT/kombu_ssl_certfile').with_value('/srv/sahara_ssl.crt') }
it { is_expected.to contain_sahara_config('DEFAULT/kombu_ssl_ca_certs').with_value('/srv/cacert') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest3') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost3') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5671') }
it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('ssl') }
end
end

View File

@ -17,7 +17,7 @@ describe 'sahara::notify::rabbitmq' do
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') }
it { is_expected.to contain_sahara_config('DEFAULT/amqp_durable_queues').with_value('false') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') }
it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('openstack') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('notifications') }
@ -101,7 +101,7 @@ describe 'sahara::notify::rabbitmq' do
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') }
it { is_expected.to contain_sahara_config('DEFAULT/amqp_durable_queues').with_value('true') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') }
end
describe 'when passing params for multiple rabbit hosts' do
@ -120,13 +120,4 @@ describe 'sahara::notify::rabbitmq' do
it { is_expected.to_not contain_sahara_config('oslo_messaging_rabbit/rabbit_host') }
end
describe 'when using deprecated params' do
let :params do
{
:durable_queues => true,
:rabbit_password => 'pass'
}
end
it { is_expected.to contain_sahara_config('DEFAULT/amqp_durable_queues').with_value('true') }
end
end

View File

@ -0,0 +1,35 @@
require 'spec_helper'
describe 'sahara::notify' do
let :facts do
{
:osfamily => 'Debian'
}
end
describe 'when defaults with notify enabled' do
let :params do
{:enable_notifications => 'true'}
end
it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('openstack') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_driver').with_value('messaging') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('notifications') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_level').with_value('INFO') }
end
describe 'when passing params' do
let :params do
{
:enable_notifications => 'true',
:control_exchange => 'openstack',
:notification_driver => 'messaging',
:notification_topics => 'notifications',
:notification_level => 'INFO',
}
it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('openstack') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_driver').with_value('messaging') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('notifications') }
it { is_expected.to contain_sahara_config('DEFAULT/notification_level').with_value('INFO') }
end
end
end

View File

@ -14,7 +14,7 @@ class sahara_templates::create_templates (
auth_tenant_name => $auth_tenant,
neutron => $use_neutron,
debug => true,
require => Service['sahara'],
require => Service['sahara-api'],
}
Sahara_cluster_template {
@ -25,7 +25,7 @@ class sahara_templates::create_templates (
auth_tenant_name => $auth_tenant,
neutron => $use_neutron,
debug => true,
require => Service['sahara'],
require => Service['sahara-api'],
}
Sahara_node_group_template<||> -> Sahara_cluster_template<||>

View File

@ -0,0 +1,41 @@
require 'spec_helper'
require 'shared-examples'
manifest = 'sahara/keystone.pp'
describe manifest do
shared_examples 'catalog' do
public_address = Noop.hiera('public_vip')
internal_address = Noop.hiera('management_vip', public_address)
public_ssl = Noop.hiera_structure('public_ssl/services')
api_bind_port = '8386'
if public_ssl
public_protocol = 'https'
else
public_protocol = 'http'
end
sahara_user = Noop.hiera_structure('sahara_hash/user', 'sahara')
sahara_password = Noop.hiera_structure('sahara_hash/user_password')
tenant = Noop.hiera_structure('sahara_hash/tenant', 'services')
region = Noop.hiera_structure('sahara_hash/region', 'RegionOne')
service_name = Noop.hiera_structure('sahara_hash/service_name', 'sahara')
public_url = "#{public_protocol}://#{public_address}:#{api_bind_port}/v1.1/%(tenant_id)s"
admin_url = "http://#{internal_address}:#{api_bind_port}/v1.1/%(tenant_id)s"
internal_url = "http://#{internal_address}:#{api_bind_port}/v1.1/%(tenant_id)s"
it 'should declare sahara::keystone::auth class correctly' do
should contain_class('sahara::keystone::auth').with(
'auth_name' => sahara_user,
'password' => sahara_password,
'service_type' => 'data_processing',
'service_name' => service_name,
'region' => region,
'tenant' => tenant,
'public_url' => public_url,
'admin_url' => admin_url,
'internal_url' => internal_url,
)
end
end
test_ubuntu_and_centos manifest
end

View File

@ -5,24 +5,108 @@ manifest = 'sahara/sahara.pp'
describe manifest do
shared_examples 'catalog' do
use_neutron = Noop.hiera 'use_neutron'
enabled = Noop.hiera_structure 'sahara/enabled'
db_password = Noop.hiera_structure 'sahara/db_password'
user_password = Noop.hiera_structure 'sahara/user_password'
use_neutron = Noop.hiera 'use_neutron'
rabbit_user = Noop.hiera_structure 'rabbit_hash/user'
rabbit_password = Noop.hiera_structure 'rabbit_hash/password'
ceilometer_enabled = Noop.hiera_structure 'ceilometer_hash/enabled'
auth_user = Noop.hiera_structure 'access_hash/user'
auth_password = Noop.hiera_structure 'access_hash/password'
auth_tenant = Noop.hiera_structure 'access_hash/tenant'
primary_controller = Noop.hiera('primary_controller')
service_endpoint = Noop.hiera('service_endpoint')
public_vip = Noop.hiera('public_vip')
internal_address = Noop.hiera('internal_address')
database_vip = Noop.hiera('database_vip', internal_address)
amqp_port = Noop.hiera('amqp_port')
amqp_hosts = Noop.hiera('amqp_hosts')
debug = Noop.hiera('debug', false)
verbose = Noop.hiera('verbose', true)
use_syslog = Noop.hiera('use_syslog', true)
log_facility_sahara = Noop.hiera('syslog_log_facility_sahara')
rabbit_ha_queues = Noop.hiera('rabbit_ha_queues')
public_ssl = Noop.hiera_structure('public_ssl/services')
# Sahara
if enabled
it 'should declare sahara class correctly' do
should contain_class('sahara').with(
'db_password' => db_password,
'keystone_password' => user_password,
'use_neutron' => use_neutron,
'rpc_backend' => 'rabbit',
'rabbit_ha_queues' => 'true',
firewall_rule = '201 sahara-api'
api_bind_port = '8386'
api_bind_host = internal_address
api_workers = '4'
if public_ssl
public_address = Noop.hiera_structure('public_ssl/hostname')
public_protocol = 'https'
else
public_address = public_vip
public_protocol = 'http'
end
sahara_user = Noop.hiera_structure('sahara_hash/user', 'sahara')
sahara_password = Noop.hiera_structure('sahara_hash/user_password')
tenant = Noop.hiera_structure('sahara_hash/tenant', 'services')
db_user = Noop.hiera_structure('sahara_hash/db_user', 'sahara')
db_name = Noop.hiera_structure('sahara_hash/db_name', 'sahara')
db_password = Noop.hiera_structure('sahara_hash/db_password')
db_host = Noop.hiera_structure('sahara_hash/db_host', database_vip)
read_timeout = '60'
sql_connection = "mysql://#{db_user}:#{db_password}@#{db_host}/#{db_name}?read_timeout=#{read_timeout}"
it 'should declare sahara class correctly' do
should contain_class('sahara').with(
'auth_uri' => "#{public_protocol}://#{public_address}:5000/v2.0/",
'identity_uri' => "http://#{service_endpoint}:35357/",
'rpc_backend' => 'rabbit',
'use_neutron' => use_neutron,
'admin_user' => sahara_user,
'verbose' => verbose,
'debug' => debug,
'use_syslog' => use_syslog,
'log_facility' => log_facility_sahara,
'database_connection' => sql_connection,
'admin_password' => sahara_password,
'admin_tenant_name' => tenant,
'rabbit_userid' => rabbit_user,
'rabbit_password' => rabbit_password,
'rabbit_ha_queues' => rabbit_ha_queues,
'rabbit_port' => amqp_port,
'rabbit_hosts' => amqp_hosts.split(","),
)
end
it 'should declare sahara::api class correctly' do
should contain_class('sahara::api').with(
'api_workers' => api_workers,
'host' => api_bind_host,
'port' => api_bind_port,
)
end
it 'should declare sahara::engine class correctly' do
should contain_class('sahara::engine').with(
'infrastructure_engine' => 'heat',
)
end
it 'should declare sahara::client class correctly' do
should contain_class('sahara::client')
end
if ceilometer_enabled
it 'should declare sahara::notify class correctly' do
should contain_class('sahara::notify').with(
'enable_notifications' => true,
)
end
end
# Temporarily disable as workaround for bug 1476324
# if primary_controller
# it 'should declare sahara_templates class correctly' do
# should contain_class('sahara_templates::create_templates').with(
# 'use_neutron' => use_neutron,
# 'auth_uri' => "http://#{management_ip}:5000/v2.0/",
# 'auth_password' => auth_password,
# 'auth_user' => auth_user,
# 'auth_tenant' => auth_tenant,
# )
# end
# end
end
test_ubuntu_and_centos manifest
end