Merge pull request #11 from enovance/taskmanager
Implement trove::taskmanager
This commit is contained in:
commit
6cad2a1474
@ -119,21 +119,8 @@
|
||||
# (optional) CA certificate file to use to verify connecting clients
|
||||
# Defaults to false, not set
|
||||
#
|
||||
# [*nova_proxy_admin_user*]
|
||||
# (optional) Admin username used to connect to nova.
|
||||
# Defaults to 'admin'
|
||||
#
|
||||
# [*nova_proxy_admin_pass*]
|
||||
# (required) Admin password used to connect to nova.
|
||||
#
|
||||
# [*nova_proxy_admin_tenant_name*]
|
||||
# (optional) Admin tenant name used to connect to nova.
|
||||
# Defaults to 'admin'
|
||||
#
|
||||
|
||||
class trove::api(
|
||||
$keystone_password,
|
||||
$nova_proxy_admin_pass,
|
||||
$verbose = false,
|
||||
$debug = false,
|
||||
$bind_host = '0.0.0.0',
|
||||
@ -157,8 +144,6 @@ class trove::api(
|
||||
$ca_file = false,
|
||||
$manage_service = true,
|
||||
$ensure_package = 'present',
|
||||
$nova_proxy_admin_user = 'admin',
|
||||
$nova_proxy_admin_tenant_name = 'admin',
|
||||
) inherits trove {
|
||||
|
||||
require keystone::python
|
||||
@ -199,9 +184,9 @@ class trove::api(
|
||||
'DEFAULT/bind_port': value => $bind_port;
|
||||
'DEFAULT/backlog': value => $backlog;
|
||||
'DEFAULT/trove_api_workers': value => $workers;
|
||||
'DEFAULT/nova_proxy_admin_user': value => $nova_proxy_admin_user;
|
||||
'DEFAULT/nova_proxy_admin_pass': value => $nova_proxy_admin_pass;
|
||||
'DEFAULT/nova_proxy_admin_tenant_name': value => $nova_proxy_admin_tenant_name;
|
||||
'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user;
|
||||
'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass;
|
||||
'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name;
|
||||
}
|
||||
|
||||
if $auth_url {
|
||||
|
@ -6,7 +6,7 @@
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Whether to enable the trove-conductor service
|
||||
# Defaults to false
|
||||
# Defaults to true
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether to start/stop the service
|
||||
@ -16,14 +16,184 @@
|
||||
# (optional) The state of the trove conductor package
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*verbose*]
|
||||
# (optional) Rather to log the trove api service at verbose level.
|
||||
# Default: false
|
||||
#
|
||||
# [*debug*]
|
||||
# (optional) Rather to log the trove api service at debug level.
|
||||
# Default: false
|
||||
#
|
||||
# [*log_file*]
|
||||
# (optional) The path of file used for logging
|
||||
# If set to boolean false, it will not log to any file.
|
||||
# Default: /var/log/trove/trove-conductor.log
|
||||
#
|
||||
# [*log_dir*]
|
||||
# (optional) directory to which trove logs are sent.
|
||||
# If set to boolean false, it will not log to any directory.
|
||||
# Defaults to '/var/log/trove'
|
||||
#
|
||||
# [*use_syslog*]
|
||||
# (optional) Use syslog for logging.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*log_facility*]
|
||||
# (optional) Syslog facility to receive log lines.
|
||||
# Defaults to 'LOG_USER'.
|
||||
#
|
||||
# [*auth_url*]
|
||||
# (optional) Authentication URL.
|
||||
# Defaults to 'http://localhost:5000/v2.0'.
|
||||
#
|
||||
# [*control_exchange*]
|
||||
# (optional) Control exchange.
|
||||
# Defaults to 'trove'.
|
||||
#
|
||||
# [*conductor_manager*]
|
||||
# (optional) Trove conductor manager.
|
||||
# Defaults to 'trove.conductor.manager.Manager'.
|
||||
#
|
||||
class trove::conductor(
|
||||
$enabled = false,
|
||||
$manage_service = true,
|
||||
$ensure_package = 'present'
|
||||
) {
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$ensure_package = 'present',
|
||||
$verbose = false,
|
||||
$debug = false,
|
||||
$log_file = '/var/log/trove/trove-conductor.log',
|
||||
$log_dir = '/var/log/trove',
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$auth_url = 'http://localhost:5000/v2.0',
|
||||
$control_exchange = 'trove',
|
||||
$conductor_manager = 'trove.conductor.manager.Manager',
|
||||
) inherits trove {
|
||||
|
||||
include trove::params
|
||||
|
||||
Package[$::trove::params::conductor_package_name] -> Trove_conductor_config<||>
|
||||
Trove_conductor_config<||> ~> Exec['post-trove_config']
|
||||
Trove_conductor_config<||> ~> Service['trove-conductor']
|
||||
|
||||
if $::trove::database_connection {
|
||||
if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
if ($::trove::mysql_module >= 2.2) {
|
||||
require 'mysql::bindings'
|
||||
require 'mysql::bindings::python'
|
||||
} else {
|
||||
require 'mysql::python'
|
||||
}
|
||||
} elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
|
||||
} elsif($::trove::database_connection =~ /sqlite:\/\//) {
|
||||
|
||||
} else {
|
||||
fail("Invalid db connection ${::trove::database_connection}")
|
||||
}
|
||||
trove_conductor_config {
|
||||
'DEFAULT/sql_connection': value => $::trove::database_connection;
|
||||
}
|
||||
}
|
||||
|
||||
# basic service config
|
||||
trove_conductor_config {
|
||||
'DEFAULT/verbose': value => $verbose;
|
||||
'DEFAULT/debug': value => $debug;
|
||||
'DEFAULT/trove_auth_url': value => $auth_url;
|
||||
'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user;
|
||||
'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name;
|
||||
'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass;
|
||||
'DEFAULT/control_exchange': value => $control_exchange;
|
||||
}
|
||||
|
||||
if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' {
|
||||
# I may want to support exporting and collecting these
|
||||
trove_conductor_config {
|
||||
'DEFAULT/rabbit_password': value => $::trove::rabbit_password, secret => true;
|
||||
'DEFAULT/rabbit_userid': value => $::trove::rabbit_userid;
|
||||
'DEFAULT/rabbit_virtual_host': value => $::trove::rabbit_virtual_host;
|
||||
'DEFAULT/rabbit_use_ssl': value => $::trove::rabbit_use_ssl;
|
||||
'DEFAULT/amqp_durable_queues': value => $::trove::amqp_durable_queues;
|
||||
'DEFAULT/rabbit_notification_topic': value => $::trove::rabbit_notification_topic;
|
||||
}
|
||||
|
||||
if $::trove::rabbit_use_ssl {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/kombu_ssl_ca_certs': value => $::trove::kombu_ssl_ca_certs;
|
||||
'DEFAULT/kombu_ssl_certfile': value => $::trove::kombu_ssl_certfile;
|
||||
'DEFAULT/kombu_ssl_keyfile': value => $::trove::kombu_ssl_keyfile;
|
||||
'DEFAULT/kombu_ssl_version': value => $::trove::kombu_ssl_version;
|
||||
}
|
||||
} else {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/kombu_ssl_ca_certs': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_certfile': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_keyfile': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_version': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $::trove::rabbit_hosts {
|
||||
trove_conductor_config { 'DEFAULT/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
|
||||
trove_conductor_config { 'DEFAULT/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_conductor_config { 'DEFAULT/rabbit_host': value => $::trove::rabbit_host }
|
||||
trove_conductor_config { 'DEFAULT/rabbit_port': value => $::trove::rabbit_port }
|
||||
trove_conductor_config { 'DEFAULT/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
|
||||
trove_conductor_config { 'DEFAULT/rabbit_ha_queues': value => false }
|
||||
}
|
||||
}
|
||||
|
||||
if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname;
|
||||
'DEFAULT/qpid_port': value => $::trove::qpid_port;
|
||||
'DEFAULT/qpid_username': value => $::trove::qpid_username;
|
||||
'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true;
|
||||
'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat;
|
||||
'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol;
|
||||
'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay;
|
||||
}
|
||||
if is_array($::trove::qpid_sasl_mechanisms) {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Logging
|
||||
if $log_file {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/log_file': value => $log_file;
|
||||
}
|
||||
} else {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/log_file': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $log_dir {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/log_dir': value => $log_dir;
|
||||
}
|
||||
} else {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/log_dir': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
# Syslog
|
||||
if $use_syslog {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/use_syslog' : value => true;
|
||||
'DEFAULT/syslog_log_facility' : value => $log_facility;
|
||||
}
|
||||
} else {
|
||||
trove_conductor_config {
|
||||
'DEFAULT/use_syslog': value => false;
|
||||
}
|
||||
}
|
||||
|
||||
trove::generic_service { 'conductor':
|
||||
enabled => $enabled,
|
||||
manage_service => $manage_service,
|
||||
|
@ -49,6 +49,10 @@
|
||||
# (optional) Connect over SSL for RabbitMQ
|
||||
# Defaults to false
|
||||
#
|
||||
# [*rabbit_notification_topic*]
|
||||
# (optional) Notification topic.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*kombu_ssl_ca_certs*]
|
||||
# (optional) SSL certification authority file (valid only if SSL enabled).
|
||||
# Defaults to undef
|
||||
@ -122,23 +126,39 @@
|
||||
# (optional) Timeout before idle db connections are reaped.
|
||||
# Defaults to 3600
|
||||
#
|
||||
# [*nova_proxy_admin_user*]
|
||||
# (optional) Admin username used to connect to nova.
|
||||
# Defaults to 'admin'
|
||||
#
|
||||
# [*nova_proxy_admin_pass*]
|
||||
# (required) Admin password used to connect to nova.
|
||||
#
|
||||
# [*nova_proxy_admin_tenant_name*]
|
||||
# (optional) Admin tenant name used to connect to nova.
|
||||
# Defaults to 'admin'
|
||||
#
|
||||
|
||||
class trove(
|
||||
$rabbit_host = 'localhost',
|
||||
$rabbit_hosts = false,
|
||||
$rabbit_password = 'guest',
|
||||
$rabbit_port = '5672',
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_use_ssl = false,
|
||||
$kombu_ssl_ca_certs = undef,
|
||||
$kombu_ssl_certfile = undef,
|
||||
$kombu_ssl_keyfile = undef,
|
||||
$kombu_ssl_version = 'SSLv3',
|
||||
$amqp_durable_queues = false,
|
||||
$database_connection = 'sqlite:////var/lib/trove/trove.sqlite',
|
||||
$database_idle_timeout = 3600,
|
||||
$mysql_module = '0.9',
|
||||
$rpc_backend = 'trove.openstack.common.rpc.impl_kombu',
|
||||
$nova_proxy_admin_pass,
|
||||
$rabbit_host = 'localhost',
|
||||
$rabbit_hosts = false,
|
||||
$rabbit_password = 'guest',
|
||||
$rabbit_port = '5672',
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_use_ssl = false,
|
||||
$rabbit_notification_topic = 'notifications',
|
||||
$kombu_ssl_ca_certs = undef,
|
||||
$kombu_ssl_certfile = undef,
|
||||
$kombu_ssl_keyfile = undef,
|
||||
$kombu_ssl_version = 'SSLv3',
|
||||
$amqp_durable_queues = false,
|
||||
$database_connection = 'sqlite:////var/lib/trove/trove.sqlite',
|
||||
$database_idle_timeout = 3600,
|
||||
$mysql_module = '0.9',
|
||||
$rpc_backend = 'trove.openstack.common.rpc.impl_kombu',
|
||||
$nova_proxy_admin_user = 'admin',
|
||||
$nova_proxy_admin_tenant_name = 'admin',
|
||||
){
|
||||
include trove::params
|
||||
|
||||
|
211
manifests/taskmanager.pp
Normal file
211
manifests/taskmanager.pp
Normal file
@ -0,0 +1,211 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# == Class: trove::taskmanager
|
||||
#
|
||||
# Manages trove taskmanager package and service
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Whether to enable the trove-taskmanager service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether to start/stop the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*ensure_package*]
|
||||
# (optional) The state of the trove taskmanager package
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*verbose*]
|
||||
# (optional) Rather to log the trove api service at verbose level.
|
||||
# Default: false
|
||||
#
|
||||
# [*debug*]
|
||||
# (optional) Rather to log the trove api service at debug level.
|
||||
# Default: false
|
||||
#
|
||||
# [*log_file*]
|
||||
# (optional) The path of file used for logging
|
||||
# If set to boolean false, it will not log to any file.
|
||||
# Default: /var/log/trove/trove-taskmanager.log
|
||||
#
|
||||
# [*log_dir*]
|
||||
# (optional) directory to which trove logs are sent.
|
||||
# If set to boolean false, it will not log to any directory.
|
||||
# Defaults to '/var/log/trove'
|
||||
#
|
||||
# [*use_syslog*]
|
||||
# (optional) Use syslog for logging.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*log_facility*]
|
||||
# (optional) Syslog facility to receive log lines.
|
||||
# Defaults to 'LOG_USER'.
|
||||
#
|
||||
# [*auth_url*]
|
||||
# (optional) Authentication URL.
|
||||
# Defaults to 'http://localhost:5000/v2.0'.
|
||||
#
|
||||
|
||||
class trove::taskmanager(
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$debug = false,
|
||||
$verbose = false,
|
||||
$log_file = '/var/log/trove/trove-taskmanager.log',
|
||||
$log_dir = '/var/log/trove',
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$auth_url = 'http://localhost:5000/v2.0',
|
||||
$ensure_package = 'present'
|
||||
) inherits trove {
|
||||
|
||||
include trove::params
|
||||
|
||||
Package[$::trove::params::taskmanager_package_name] -> Trove_taskmanager_config<||>
|
||||
Trove_taskmanager_config<||> ~> Exec['post-trove_config']
|
||||
Trove_taskmanager_config<||> ~> Service['trove-taskmanager']
|
||||
|
||||
if $::trove::database_connection {
|
||||
if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
if ($::trove::mysql_module >= 2.2) {
|
||||
require 'mysql::bindings'
|
||||
require 'mysql::bindings::python'
|
||||
} else {
|
||||
require 'mysql::python'
|
||||
}
|
||||
} elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
|
||||
} elsif($::trove::database_connection =~ /sqlite:\/\//) {
|
||||
|
||||
} else {
|
||||
fail("Invalid db connection ${::trove::database_connection}")
|
||||
}
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/sql_connection': value => $::trove::database_connection;
|
||||
'DEFAULT/sql_idle_timeout': value => $::trove::database_idle_timeoutl;
|
||||
}
|
||||
}
|
||||
|
||||
# basic service config
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/verbose': value => $verbose;
|
||||
'DEFAULT/debug': value => $debug;
|
||||
'DEFAULT/trove_auth_url': value => $auth_url;
|
||||
'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user;
|
||||
'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass;
|
||||
'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name;
|
||||
}
|
||||
|
||||
if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' {
|
||||
# I may want to support exporting and collecting these
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/rabbit_password': value => $::trove::rabbit_password, secret => true;
|
||||
'DEFAULT/rabbit_userid': value => $::trove::rabbit_userid;
|
||||
'DEFAULT/rabbit_virtual_host': value => $::trove::rabbit_virtual_host;
|
||||
'DEFAULT/rabbit_use_ssl': value => $::trove::rabbit_use_ssl;
|
||||
'DEFAULT/amqp_durable_queues': value => $::trove::amqp_durable_queues;
|
||||
}
|
||||
|
||||
if $::trove::rabbit_use_ssl {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/kombu_ssl_ca_certs': value => $::trove::kombu_ssl_ca_certs;
|
||||
'DEFAULT/kombu_ssl_certfile': value => $::trove::kombu_ssl_certfile;
|
||||
'DEFAULT/kombu_ssl_keyfile': value => $::trove::kombu_ssl_keyfile;
|
||||
'DEFAULT/kombu_ssl_version': value => $::trove::kombu_ssl_version;
|
||||
}
|
||||
} else {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/kombu_ssl_ca_certs': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_certfile': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_keyfile': ensure => absent;
|
||||
'DEFAULT/kombu_ssl_version': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $::trove::rabbit_hosts {
|
||||
trove_taskmanager_config { 'DEFAULT/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
|
||||
trove_taskmanager_config { 'DEFAULT/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_taskmanager_config { 'DEFAULT/rabbit_host': value => $::trove::rabbit_host }
|
||||
trove_taskmanager_config { 'DEFAULT/rabbit_port': value => $::trove::rabbit_port }
|
||||
trove_taskmanager_config { 'DEFAULT/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
|
||||
trove_taskmanager_config { 'DEFAULT/rabbit_ha_queues': value => false }
|
||||
}
|
||||
}
|
||||
|
||||
if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname;
|
||||
'DEFAULT/qpid_port': value => $::trove::qpid_port;
|
||||
'DEFAULT/qpid_username': value => $::trove::qpid_username;
|
||||
'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true;
|
||||
'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat;
|
||||
'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol;
|
||||
'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay;
|
||||
}
|
||||
if is_array($::trove::qpid_sasl_mechanisms) {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Logging
|
||||
if $log_file {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/log_file': value => $log_file;
|
||||
}
|
||||
} else {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/log_file': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $log_dir {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/log_dir': value => $log_dir;
|
||||
}
|
||||
} else {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/log_dir': ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
# Syslog
|
||||
if $use_syslog {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/use_syslog' : value => true;
|
||||
'DEFAULT/syslog_log_facility' : value => $log_facility;
|
||||
}
|
||||
} else {
|
||||
trove_taskmanager_config {
|
||||
'DEFAULT/use_syslog': value => false;
|
||||
}
|
||||
}
|
||||
|
||||
trove::generic_service { 'taskmanager':
|
||||
enabled => $enabled,
|
||||
manage_service => $manage_service,
|
||||
package_name => $::trove::params::taskmanager_package_name,
|
||||
service_name => $::trove::params::taskmanager_service_name,
|
||||
ensure_package => $ensure_package,
|
||||
}
|
||||
}
|
@ -23,20 +23,24 @@ describe 'trove::api' do
|
||||
|
||||
let :params do
|
||||
{ :keystone_password => 'passw0rd',
|
||||
:nova_proxy_admin_pass => 'verysecrete',
|
||||
:auth_host => '10.0.0.10',
|
||||
:auth_url => 'http://10.0.0.10:5000/v2.0',
|
||||
:auth_port => '35357',
|
||||
:auth_protocol => 'https',
|
||||
:keystone_tenant => '_services_',
|
||||
:keystone_user => 'trove',
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'trove-api' do
|
||||
|
||||
context 'with default parameters' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete'}"
|
||||
end
|
||||
|
||||
it 'installs trove-api package and service' do
|
||||
should contain_service('trove-api').with(
|
||||
:name => platform_params[:api_service_name],
|
||||
@ -73,7 +77,8 @@ describe 'trove::api' do
|
||||
context 'when using a single RabbitMQ server' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
should contain_trove_config('DEFAULT/rabbit_host').with_value('10.0.0.1')
|
||||
@ -83,7 +88,8 @@ describe 'trove::api' do
|
||||
context 'when using multiple RabbitMQ servers' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
rabbit_hosts => ['10.0.0.1','10.0.0.2']}"
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_hosts => ['10.0.0.1','10.0.0.2']}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
should contain_trove_config('DEFAULT/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
@ -93,7 +99,8 @@ describe 'trove::api' do
|
||||
context 'when using MySQL' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
database_connection => 'mysql://trove:pass@10.0.0.1/trove'}"
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
database_connection => 'mysql://trove:pass@10.0.0.1/trove'}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
should contain_trove_config('DEFAULT/sql_connection').with_value('mysql://trove:pass@10.0.0.1/trove')
|
||||
|
@ -2,29 +2,98 @@ require 'spec_helper'
|
||||
|
||||
describe 'trove::conductor' do
|
||||
|
||||
let :pre_condition do
|
||||
'include trove'
|
||||
shared_examples 'trove-conductor' do
|
||||
|
||||
context 'with default parameters' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete'}"
|
||||
end
|
||||
|
||||
it 'installs trove-conductor package and service' do
|
||||
should contain_service('trove-conductor').with(
|
||||
:name => platform_params[:conductor_service_name],
|
||||
:ensure => 'running',
|
||||
:hasstatus => true,
|
||||
:enable => true
|
||||
)
|
||||
should contain_package('trove-conductor').with(
|
||||
:name => platform_params[:conductor_package_name],
|
||||
:ensure => 'present',
|
||||
:notify => 'Service[trove-conductor]'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures trove-conductor with default parameters' do
|
||||
should contain_trove_conductor_config('DEFAULT/verbose').with_value(false)
|
||||
should contain_trove_conductor_config('DEFAULT/debug').with_value(false)
|
||||
should contain_trove_conductor_config('DEFAULT/nova_proxy_admin_user').with_value('admin')
|
||||
should contain_trove_conductor_config('DEFAULT/nova_proxy_admin_pass').with_value('verysecrete')
|
||||
should contain_trove_conductor_config('DEFAULT/nova_proxy_admin_tenant_name').with_value('admin')
|
||||
end
|
||||
|
||||
context 'when using a single RabbitMQ server' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-conductor with RabbitMQ' do
|
||||
should contain_trove_conductor_config('DEFAULT/rabbit_host').with_value('10.0.0.1')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using multiple RabbitMQ servers' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_hosts => ['10.0.0.1','10.0.0.2']}"
|
||||
end
|
||||
it 'configures trove-conductor with RabbitMQ' do
|
||||
should contain_trove_conductor_config('DEFAULT/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using MySQL' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
database_connection => 'mysql://trove:pass@10.0.0.1/trove'}"
|
||||
end
|
||||
it 'configures trove-conductor with RabbitMQ' do
|
||||
should contain_trove_conductor_config('DEFAULT/sql_connection').with_value('mysql://trove:pass@10.0.0.1/trove')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
{ :osfamily => 'Debian',
|
||||
:processorcount => 8 }
|
||||
end
|
||||
|
||||
it_behaves_like 'generic trove service', {
|
||||
:name => 'trove-conductor',
|
||||
:package_name => 'trove-conductor',
|
||||
:service_name => 'trove-conductor' }
|
||||
let :platform_params do
|
||||
{ :conductor_package_name => 'trove-conductor',
|
||||
:conductor_service_name => 'trove-conductor' }
|
||||
end
|
||||
|
||||
it_configures 'trove-conductor'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
{ :osfamily => 'RedHat',
|
||||
:processorcount => 8 }
|
||||
end
|
||||
|
||||
it_behaves_like 'generic trove service', {
|
||||
:name => 'trove-conductor',
|
||||
:package_name => 'openstack-trove-conductor',
|
||||
:service_name => 'openstack-trove-conductor' }
|
||||
let :platform_params do
|
||||
{ :conductor_package_name => 'openstack-trove-conductor',
|
||||
:conductor_service_name => 'openstack-trove-conductor' }
|
||||
end
|
||||
|
||||
it_configures 'trove-conductor'
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -22,6 +22,10 @@ require 'spec_helper'
|
||||
|
||||
describe 'trove' do
|
||||
|
||||
let :params do
|
||||
{ :nova_proxy_admin_pass => 'passw0rd' }
|
||||
end
|
||||
|
||||
shared_examples_for 'trove' do
|
||||
it { should contain_class('trove::params') }
|
||||
end
|
||||
|
118
spec/classes/trove_taskmanager_spec.rb
Normal file
118
spec/classes/trove_taskmanager_spec.rb
Normal file
@ -0,0 +1,118 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@etrovence.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@etrovence.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for trove::taskmanager
|
||||
#
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'trove::taskmanager' do
|
||||
|
||||
shared_examples 'trove-taskmanager' do
|
||||
|
||||
context 'with default parameters' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete'}"
|
||||
end
|
||||
|
||||
it 'installs trove-taskmanager package and service' do
|
||||
should contain_service('trove-taskmanager').with(
|
||||
:name => platform_params[:taskmanager_service_name],
|
||||
:ensure => 'running',
|
||||
:hasstatus => true,
|
||||
:enable => true
|
||||
)
|
||||
should contain_package('trove-taskmanager').with(
|
||||
:name => platform_params[:taskmanager_package_name],
|
||||
:ensure => 'present',
|
||||
:notify => 'Service[trove-taskmanager]'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures trove-taskmanager with default parameters' do
|
||||
should contain_trove_taskmanager_config('DEFAULT/verbose').with_value(false)
|
||||
should contain_trove_taskmanager_config('DEFAULT/debug').with_value(false)
|
||||
should contain_trove_taskmanager_config('DEFAULT/nova_proxy_admin_user').with_value('admin')
|
||||
should contain_trove_taskmanager_config('DEFAULT/nova_proxy_admin_pass').with_value('verysecrete')
|
||||
should contain_trove_taskmanager_config('DEFAULT/nova_proxy_admin_tenant_name').with_value('admin')
|
||||
end
|
||||
|
||||
context 'when using a single RabbitMQ server' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-taskmanager with RabbitMQ' do
|
||||
should contain_trove_taskmanager_config('DEFAULT/rabbit_host').with_value('10.0.0.1')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using multiple RabbitMQ servers' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_hosts => ['10.0.0.1','10.0.0.2']}"
|
||||
end
|
||||
it 'configures trove-taskmanager with RabbitMQ' do
|
||||
should contain_trove_taskmanager_config('DEFAULT/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using MySQL' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
database_connection => 'mysql://trove:pass@10.0.0.1/trove'}"
|
||||
end
|
||||
it 'configures trove-taskmanager with RabbitMQ' do
|
||||
should contain_trove_taskmanager_config('DEFAULT/sql_connection').with_value('mysql://trove:pass@10.0.0.1/trove')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian',
|
||||
:processorcount => 8 }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :taskmanager_package_name => 'trove-taskmanager',
|
||||
:taskmanager_service_name => 'trove-taskmanager' }
|
||||
end
|
||||
|
||||
it_configures 'trove-taskmanager'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat',
|
||||
:processorcount => 8 }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :taskmanager_package_name => 'openstack-trove-taskmanager',
|
||||
:taskmanager_service_name => 'openstack-trove-taskmanager' }
|
||||
end
|
||||
|
||||
it_configures 'trove-taskmanager'
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user