Initial module implementation

- Add parameters class
 - Add openstack policy class
 - Add database sync class
 - Add basic murano class
 - Add tests

Change-Id: If34c3b12afb2fe7a64b24a8660d6e8d1806bb8fd
Closes-Bug: #1475628
Related-Bug: #1496397
This commit is contained in:
Alexey Deryugin 2015-08-10 11:39:03 +03:00
parent 518800e37f
commit bc0362b3df
9 changed files with 860 additions and 0 deletions

91
manifests/db.pp Normal file
View File

@ -0,0 +1,91 @@
# == Class: murano:db
#
# Configure the Murano database
#
# == Parameters
#
# [*database_connection*]
# (Optional) Non-sqllite database for murano
# Defaults to 'mysql://murano:secrete@localhost:3306/murano'
#
# [*database_max_retries*]
# (Optional) Maximum number of database connection retries during startup.
# Set to -1 to specify an infinite retry count.
# Defaults to 10.
#
# [*database_idle_timeout*]
# (Optional) Timeout before idle SQL connections are reaped.
# Defaults to 3600.
#
# [*database_retry_interval*]
# (optional) Interval between retries of opening a database connection.
# Defaults to 10.
#
# [*database_min_pool_size*]
# (optional) Minimum number of SQL connections to keep open in a pool.
# Defaults to 1.
#
# [*database_max_pool_size*]
# (optional) Maximum number of SQL connections to keep open in a pool.
# Defaults to 10.
#
# [*database_max_overflow*]
# (optional) If set, use this value for max_overflow with sqlalchemy.
# Defaults to 20.
#
class murano::db (
$database_connection = 'mysql://murano:secrete@localhost:3306/murano',
$database_idle_timeout = 3600,
$database_min_pool_size = 1,
$database_max_pool_size = 10,
$database_max_retries = 10,
$database_retry_interval = 10,
$database_max_overflow = 20,
) {
# NOTE(aderyugin): In order to keep backward compatibility we rely on the pick function
# to use murano::<myparam> if murano::db::<myparam> isn't specified.
$database_connection_real = pick($::murano::database_connection, $database_connection)
$database_idle_timeout_real = pick($::murano::database_idle_timeout, $database_idle_timeout)
$database_min_pool_size_real = pick($::murano::database_min_pool_size, $database_min_pool_size)
$database_max_pool_size_real = pick($::murano::database_max_pool_size, $database_max_pool_size)
$database_max_retries_real = pick($::murano::database_max_retries, $database_max_retries)
$database_retry_interval_real = pick($::murano::database_retry_interval, $database_retry_interval)
$database_max_overflow_real = pick($::murano::database_max_overflow, $database_max_overflow)
validate_re($database_connection_real, '(mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
case $database_connection_real {
/^mysql:\/\//: {
$backend_package = false
require mysql::bindings
require mysql::bindings::python
}
/^postgresql:\/\//: {
$backend_package = $::murano::params::psycopg_package_name
require postgresql::lib::python
}
default: {
fail('Unsupported db backend configured')
}
}
if $backend_package and !defined(Package[$backend_package]) {
package {'murano-backend-package':
ensure => present,
name => $backend_package,
tag => 'openstack',
}
}
murano_config {
'database/connection': value => $database_connection_real;
'database/idle_timeout': value => $database_idle_timeout_real;
'database/min_pool_size': value => $database_min_pool_size_real;
'database/max_retries': value => $database_max_retries_real;
'database/retry_interval': value => $database_retry_interval_real;
'database/max_pool_size': value => $database_max_pool_size_real;
'database/max_overflow': value => $database_max_overflow_real;
}
}

21
manifests/db/sync.pp Normal file
View File

@ -0,0 +1,21 @@
#
# Class to execute murano dbsync
#
class murano::db::sync {
include ::murano::params
Package <| title == 'murano-common' |> ~> Exec['murano-dbmanage']
Exec['murano-dbmanage'] ~> Service <| tag == 'murano-service' |>
Murano_config <| title == 'database/connection' |> ~> Exec['murano-dbmanage']
exec { 'murano-dbmanage':
command => $::murano::params::dbmanage_command,
path => '/usr/bin',
user => 'murano',
refreshonly => true,
logoutput => on_failure,
}
}

330
manifests/init.pp Normal file
View File

@ -0,0 +1,330 @@
# == Class: murano
#
# murano base package & configuration
#
# === Parameters
#
# [*package_ensure*]
# (Optional) Ensure state for package
# Defaults to 'present'
#
# [*verbose*]
# (Optional) Should the service log verbose messages
# Defaults to false
#
# [*debug*]
# (Optional) Should the service log debug messages
# Defaults to false
#
# [*use_syslog*]
# (Optional) Should the service use Syslog
# Defaults to false
#
# [*log_facility*]
# (Optional) Syslog facility to recieve logs
# Defaults to 'LOG_LOCAL0'
#
# [*log_dir*]
# (Optional) Directory to store logs
# Defaults to '/var/log/murano'
#
# [*data_dir*]
# (Optional) Directory to store data
# Defaults to '/var/cache/murano'
#
# [*notification_driver*]
# (Optional) Notification driver to use
# Defaults to 'messagingv2'
#
# [*rabbit_os_host*]
# (Optional) Host for openstack rabbit server
# Defaults to '127.0.0.1'
#
# [*rabbit_os_port*]
# (Optional) Port for openstack rabbit server
# Defaults to '5672'
#
# [*rabbit_os_user*]
# (Optional) Username for openstack rabbit server
# Defaults to 'guest'
#
# [*rabbit_os_password*]
# (Optional) Password for openstack rabbit server
# Defaults to 'guest'
#
# [*rabbit_ha_queues*]
# (Optional) Should murano api use ha queues
# Defaults to 'guest'
#
# [*rabbit_own_host*]
# (Optional) Host for murano rabbit server
# Defaults to '127.0.0.1'
#
# [*rabbit_own_port*]
# (Optional) Port for murano rabbit server
# Defaults to '5672'
#
# [*rabbit_own_user*]
# (Optional) Username for murano rabbit server
# Defaults to 'guest'
#
# [*rabbit_own_password*]
# (Optional) Password for murano rabbit server
# Defaults to 'guest'
#
# [*rabbit_own_vhost*]
# (Optional) Virtual host for murano rabbit server
# Defaults to 'murano'
#
# [*service_host*]
# (Optional) Host for murano to listen on
# Defaults to '0.0.0.0'
#
# [*service_port*]
# (Optional) Port for murano to listen on
# Defaults to 8082
#
# [*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 undef
#
# [*key_file*]
# (optional) Private key file to use when starting API server securely
# Defaults to undef
#
# [*ca_file*]
# (optional) CA certificate file to use to verify connecting clients
# Defaults to undef
#
# [*use_neutron*]
# (Optional) Whether to use neutron
# Defaults to false
#
# [*external_network*]
# (Optional) Name of the external Neutron network
# which will be use by Murano
# Defaults to undef
#
# [*default_router*]
# (Optional) Router name for Murano networks
# Defaults to 'murano-default-router'
#
# [*default_nameservers*]
# (Optional) Domain Name Servers to use in Murano networks
# Defaults to '[]'
#
# [*use_trusts*]
# (Optional) Whether to use trust token instead of user token
# Defaults to false
#
# == database configuration options
#
# [*database_connection*]
# (Optional) Database URI for murano
# Defaults to undef.
#
# [*database_max_retries*]
# (Optional) Maximum number of database connection retries during startup.
# Set to -1 to specify an infinite retry count.
# Defaults to undef.
#
# [*database_idle_timeout*]
# (Optional) Timeout before idle SQL connections are reaped.
# Defaults to undef.
#
# [*database_retry_interval*]
# (optional) Interval between retries of opening a database connection.
# Defaults to undef.
#
# [*database_min_pool_size*]
# (optional) Minimum number of SQL connections to keep open in a pool.
# Defaults to undef.
#
# [*database_max_pool_size*]
# (optional) Maximum number of SQL connections to keep open in a pool.
# Defaults to undef.
#
# [*database_max_overflow*]
# (optional) If set, use this value for max_overflow with sqlalchemy.
# Defaults to undef.
#
# [*sync_db*]
# (Optional) Enable dbsync
# Defaults to true.
#
# == keystone authentication options
#
# [*admin_user*]
# (Optional) Username for murano credentials
# Defaults to 'admin'
#
# [*admin_password*]
# (Required) Password for murano credentials
# Defaults to false
#
# [*admin_tenant_name*]
# (Optional) Tenant for admin_username
# Defaults to 'admin'
#
# [*auth_uri*]
# (Optional) Public identity endpoint
# Defaults to 'http://127.0.0.1:5000/v2.0/'
#
# [*identity_uri*]
# (Optional) Admin identity endpoint
# Defaults to 'http://127.0.0.1:35357/'#
#
# [*signing_dir*]
# (Optional) Directory used to cache files related to PKI tokens
# Defaults to '/tmp/keystone-signing-muranoapi'
#
class murano(
$admin_password,
$package_ensure = 'present',
$verbose = false,
$debug = false,
$use_syslog = false,
$log_facility = 'LOG_LOCAL0',
$log_dir = '/var/log/murano',
$data_dir = '/var/cache/murano',
$notification_driver = 'messagingv2',
$rabbit_os_host = '127.0.0.1',
$rabbit_os_port = '5672',
$rabbit_os_user = 'guest',
$rabbit_os_password = 'guest',
$rabbit_ha_queues = false,
$rabbit_own_host = '127.0.0.1',
$rabbit_own_port = '5672',
$rabbit_own_user = 'guest',
$rabbit_own_password = 'guest',
$rabbit_own_vhost = 'murano',
$service_host = '127.0.0.1',
$service_port = '8082',
$use_ssl = false,
$cert_file = undef,
$key_file = undef,
$ca_file = undef,
$use_neutron = false,
$external_network = $::murano::params::default_external_network,
$default_router = 'murano-default-router',
$default_nameservers = '[]',
$use_trusts = false,
$database_connection = undef,
$database_max_retries = undef,
$database_idle_timeout = undef,
$database_min_pool_size = undef,
$database_max_pool_size = undef,
$database_max_retries = undef,
$database_retry_interval = undef,
$database_max_overflow = undef,
$sync_db = true,
$admin_user = 'admin',
$admin_tenant_name = 'admin',
$auth_uri = 'http://127.0.0.1:5000/v2.0/',
$identity_uri = 'http://127.0.0.1:35357/',
$signing_dir = '/tmp/keystone-signing-muranoapi',
) {
include ::murano::params
include ::murano::policy
include ::murano::db
validate_string($admin_password)
package { 'murano-common':
ensure => $package_ensure,
name => $::murano::params::common_package_name,
tag => ['openstack', 'murano-package'],
}
$service_protocol = $use_ssl ? {
true => 'https',
default => 'http',
}
murano_config {
'DEFAULT/use_syslog' : value => $use_syslog;
}
if $use_syslog {
murano_config {
'DEFAULT/use_syslog_rfc_format' : value => true;
'DEFAULT/syslog_log_facility': value => $log_facility;
}
}
if $use_neutron {
murano_config {
'networking/external_network' : value => $external_network;
'networking/router_name' : value => $default_router;
'networking/create_router' : value => true;
}
} else {
murano_config {
'networking/external_network' : ensure => absent;
}
}
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')
}
murano_config {
'ssl/cert_file' : value => $cert_file;
'ssl/key_file' : value => $key_file;
'ssl/ca_file' : value => $ca_file;
}
} else {
murano_config {
'ssl/cert_file' : ensure => absent;
'ssl/key_file' : ensure => absent;
'ssl/ca_file' : ensure => absent;
}
}
murano_config {
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/debug' : value => $debug;
'DEFAULT/log_dir' : value => $log_dir;
'DEFAULT/notification_driver' : value => $notification_driver;
'murano/url' : value => "${service_protocol}://${service_host}:${service_port}";
'engine/use_trusts' : value => $use_trusts;
'oslo_messaging_rabbit/rabbit_userid' : value => $rabbit_os_user;
'oslo_messaging_rabbit/rabbit_password' : value => $rabbit_os_password;
'oslo_messaging_rabbit/rabbit_hosts' : value => $rabbit_os_host;
'oslo_messaging_rabbit/rabbit_port' : value => $rabbit_os_port;
'oslo_messaging_rabbit/rabbit_ha_queues' : value => $rabbit_ha_queues;
'rabbitmq/login' : value => $rabbit_own_user;
'rabbitmq/password' : value => $rabbit_own_password;
'rabbitmq/host' : value => $rabbit_own_host;
'rabbitmq/port' : value => $rabbit_own_port;
'rabbitmq/virtual_host' : value => $rabbit_own_vhost;
'keystone_authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/admin_user' : value => $admin_user;
'keystone_authtoken/admin_tenant_name' : value => $admin_tenant_name;
'keystone_authtoken/signing_dir' : value => $signing_dir;
'keystone_authtoken/identity_uri' : value => $identity_uri;
'keystone_authtoken/admin_password' : value => $admin_password;
'networking/default_dns': value => $default_nameservers;
}
if $sync_db {
include ::murano::db::sync
}
}

42
manifests/params.pp Normal file
View File

@ -0,0 +1,42 @@
# == Class: murano::params
#
# Parameters for puppet-murano
#
class murano::params {
$dbmanage_command = 'murano-db-manage --config-file /etc/murano/murano.conf upgrade'
$default_external_network = 'public'
case $::osfamily {
'RedHat': {
# package names
$api_package_name = 'openstack-murano-api'
$common_package_name = 'openstack-murano-common'
$engine_package_name = 'openstack-murano-engine'
$pythonclient_package_name = 'openstack-python-muranoclient'
$dashboard_package_name = 'openstack-murano-dashboard'
$psycopg_package_name = 'python-psycopg2'
# service names
$api_service_name = 'murano-api'
$engine_service_name = 'murano-engine'
# dashboard config file
$local_settings_path = '/etc/openstack-dashboard/local_settings'
}
'Debian': {
# package names
$api_package_name = 'murano-api'
$common_package_name = 'murano-common'
$engine_package_name = 'murano-engine'
$pythonclient_package_name = 'python-muranoclient'
$dashboard_package_name = 'murano-dashboard'
$psycopg_package_name = 'python-psycopg2'
# service names
$api_service_name = 'murano-api'
$engine_service_name = 'murano-engine'
# dashboard config file
$local_settings_path = '/etc/openstack-dashboard/local_settings.py'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}")
}
}
}

28
manifests/policy.pp Normal file
View File

@ -0,0 +1,28 @@
# == Class: murano::policy
#
# Configure the murano policies
#
# === Parameters
#
# [*policies*]
# (optional) Set of policies to configure for murano
# Defaults to empty hash.
#
# [*policy_path*]
# (optional) Path to the murano policy.json file
# Defaults to /etc/murano/policy.json
#
class murano::policy (
$policies = {},
$policy_path = '/etc/murano/policy.json',
) {
validate_hash($policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
}
create_resources('openstacklib::policy::base', $policies)
}

View File

@ -0,0 +1,62 @@
require 'spec_helper'
describe 'murano::db' do
shared_examples 'murano::db' do
context 'with default parameters' do
it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:secrete@localhost:3306/murano') }
it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3600') }
it { is_expected.to contain_murano_config('database/min_pool_size').with_value('1') }
it { is_expected.to contain_murano_config('database/max_retries').with_value('10') }
it { is_expected.to contain_murano_config('database/retry_interval').with_value('10') }
it { is_expected.to contain_murano_config('database/max_pool_size').with_value('10') }
it { is_expected.to contain_murano_config('database/max_overflow').with_value('20') }
end
context 'with specific parameters' do
let :params do
{ :database_connection => 'mysql://murano:murano@localhost/murano',
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_retries => '11',
:database_retry_interval => '11',
:database_max_pool_size => '11',
:database_max_overflow => '21',
}
end
it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:murano@localhost/murano') }
it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3601') }
it { is_expected.to contain_murano_config('database/min_pool_size').with_value('2') }
it { is_expected.to contain_murano_config('database/max_retries').with_value('11') }
it { is_expected.to contain_murano_config('database/retry_interval').with_value('11') }
it { is_expected.to contain_murano_config('database/max_pool_size').with_value('11') }
it { is_expected.to contain_murano_config('database/max_overflow').with_value('21') }
end
context 'with incorrect database_connection string' do
let :params do
{ :database_connection => 'sqlite://murano:murano@localhost/murano', }
end
it_raises 'a Puppet::Error', /validate_re/
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'murano::db'
end
context 'on Redhat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'murano::db'
end
end

View File

@ -0,0 +1,44 @@
require 'spec_helper'
describe 'murano::db::sync' do
shared_examples_for 'murano-dbsync' do
it 'runs murano-dbmanage' do
is_expected.to contain_exec('murano-dbmanage').with(
:command => 'murano-db-manage --config-file /etc/murano/murano.conf upgrade',
:path => '/usr/bin',
:user => 'murano',
:refreshonly => 'true',
:logoutput => 'on_failure'
)
end
end
context 'on a RedHat osfamily' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
}
end
it_configures 'murano-dbsync'
end
context 'on a Debian osfamily' do
let :facts do
{
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
}
end
it_configures 'murano-dbsync'
end
end

View File

@ -0,0 +1,201 @@
#
# Unit tests for murano::init
#
require 'spec_helper'
describe 'murano' do
let :params do {
:admin_password => 'secrete',
}
end
shared_examples_for 'with default parameters' do
it { is_expected.to contain_class('murano::params') }
it { is_expected.to contain_class('murano::policy') }
it { is_expected.to contain_class('murano::db') }
it { is_expected.to contain_package('murano-common').with({
:ensure => 'present'
}) }
it { is_expected.to contain_class('mysql::bindings::python') }
it { is_expected.to contain_murano_config('DEFAULT/use_syslog').with_value(false) }
it { is_expected.to contain_murano_config('DEFAULT/verbose').with_value(false) }
it { is_expected.to contain_murano_config('DEFAULT/debug').with_value(false) }
it { is_expected.to contain_murano_config('DEFAULT/log_dir').with_value('/var/log/murano') }
it { is_expected.to contain_murano_config('DEFAULT/notification_driver').with_value('messagingv2') }
it { is_expected.to contain_murano_config('murano/url').with_value('http://127.0.0.1:8082') }
it { is_expected.to contain_murano_config('engine/use_trusts').with_value(false) }
it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:secrete@localhost:3306/murano') }
it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3600') }
it { is_expected.to contain_murano_config('database/min_pool_size').with_value('1') }
it { is_expected.to contain_murano_config('database/max_retries').with_value('10') }
it { is_expected.to contain_murano_config('database/retry_interval').with_value('10') }
it { is_expected.to contain_murano_config('database/max_pool_size').with_value('10') }
it { is_expected.to contain_murano_config('database/max_overflow').with_value('20') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_password').with_value('guest') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_hosts').with_value('127.0.0.1') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) }
it { is_expected.to contain_murano_config('rabbitmq/login').with_value('guest') }
it { is_expected.to contain_murano_config('rabbitmq/password').with_value('guest') }
it { is_expected.to contain_murano_config('rabbitmq/host').with_value('127.0.0.1') }
it { is_expected.to contain_murano_config('rabbitmq/port').with_value('5672') }
it { is_expected.to contain_murano_config('rabbitmq/virtual_host').with_value('murano') }
it { is_expected.to contain_murano_config('networking/default_dns').with_value('[]') }
it { is_expected.to contain_murano_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/v2.0/') }
it { is_expected.to contain_murano_config('keystone_authtoken/admin_user').with_value('admin') }
it { is_expected.to contain_murano_config('keystone_authtoken/admin_tenant_name').with_value('admin') }
it { is_expected.to contain_murano_config('keystone_authtoken/signing_dir').with_value('/tmp/keystone-signing-muranoapi') }
it { is_expected.to contain_murano_config('keystone_authtoken/identity_uri').with_value('http://127.0.0.1:35357/') }
it { is_expected.to contain_murano_config('keystone_authtoken/admin_password').with_value('secrete') }
it { is_expected.to contain_exec('murano-dbmanage') }
end
shared_examples_for 'with parameters override' do
let :params do {
:admin_password => 'secrete',
:package_ensure => 'latest',
:verbose => true,
:debug => true,
:use_syslog => true,
:log_facility => 'LOG_USER',
:log_dir => '/var/log/murano_logs',
:data_dir => '/tmp/murano_data',
:notification_driver => 'messagingv1',
:rabbit_os_host => '10.255.0.1',
:rabbit_os_port => '5673',
:rabbit_os_user => 'os',
:rabbit_os_password => 'ossecrete',
:rabbit_ha_queues => true,
:rabbit_own_host => '10.255.0.2',
:rabbit_own_port => '5674',
:rabbit_own_user => 'murano',
:rabbit_own_password => 'secrete',
:rabbit_own_vhost => 'murano_vhost',
:service_host => '10.255.0.3',
:service_port => '8088',
:use_ssl => true,
:cert_file => '/etc/murano/murano.crt',
:key_file => '/etc/murano/murano.key',
:ca_file => '/etc/murano/ca.crt',
:use_neutron => true,
:external_network => 'murano-net',
:default_router => 'murano-router',
:default_nameservers => '["8.8.8.8"]',
:use_trusts => true,
:database_connection => 'mysql://murano:murano@localhost/murano',
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_retries => '11',
:database_retry_interval => '11',
:database_max_pool_size => '11',
:database_max_overflow => '21',
:sync_db => false,
:admin_user => 'murano',
:admin_tenant_name => 'secrete',
:auth_uri => 'http://10.255.0.1:5000/v2.0/',
:identity_uri => 'http://10.255.0.1:35357/',
:signing_dir => '/tmp/keystone-muranoapi',
}
end
it { is_expected.to contain_class('murano::params') }
it { is_expected.to contain_class('murano::policy') }
it { is_expected.to contain_class('murano::db') }
it { is_expected.to contain_package('murano-common').with({
:ensure => 'latest'
}) }
it { is_expected.to contain_class('mysql::bindings::python') }
it { is_expected.to contain_murano_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_murano_config('DEFAULT/use_syslog_rfc_format').with_value(true) }
it { is_expected.to contain_murano_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
it { is_expected.to contain_murano_config('DEFAULT/verbose').with_value(true) }
it { is_expected.to contain_murano_config('DEFAULT/debug').with_value(true) }
it { is_expected.to contain_murano_config('DEFAULT/log_dir').with_value('/var/log/murano_logs') }
it { is_expected.to contain_murano_config('DEFAULT/notification_driver').with_value('messagingv1') }
it { is_expected.to contain_murano_config('murano/url').with_value('https://10.255.0.3:8088') }
it { is_expected.to contain_murano_config('engine/use_trusts').with_value(true) }
it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:murano@localhost/murano') }
it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3601') }
it { is_expected.to contain_murano_config('database/min_pool_size').with_value('2') }
it { is_expected.to contain_murano_config('database/max_retries').with_value('11') }
it { is_expected.to contain_murano_config('database/retry_interval').with_value('11') }
it { is_expected.to contain_murano_config('database/max_pool_size').with_value('11') }
it { is_expected.to contain_murano_config('database/max_overflow').with_value('21') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_userid').with_value('os') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_password').with_value('ossecrete') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_hosts').with_value('10.255.0.1') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) }
it { is_expected.to contain_murano_config('rabbitmq/login').with_value('murano') }
it { is_expected.to contain_murano_config('rabbitmq/password').with_value('secrete') }
it { is_expected.to contain_murano_config('rabbitmq/host').with_value('10.255.0.2') }
it { is_expected.to contain_murano_config('rabbitmq/port').with_value('5674') }
it { is_expected.to contain_murano_config('rabbitmq/virtual_host').with_value('murano_vhost') }
it { is_expected.to contain_murano_config('keystone_authtoken/auth_uri').with_value('http://10.255.0.1:5000/v2.0/') }
it { is_expected.to contain_murano_config('keystone_authtoken/admin_user').with_value('murano') }
it { is_expected.to contain_murano_config('keystone_authtoken/admin_tenant_name').with_value('secrete') }
it { is_expected.to contain_murano_config('keystone_authtoken/signing_dir').with_value('/tmp/keystone-muranoapi') }
it { is_expected.to contain_murano_config('keystone_authtoken/identity_uri').with_value('http://10.255.0.1:35357/') }
it { is_expected.to contain_murano_config('keystone_authtoken/admin_password').with_value('secrete') }
it { is_expected.to contain_murano_config('networking/external_network').with_value('murano-net') }
it { is_expected.to contain_murano_config('networking/router_name').with_value('murano-router') }
it { is_expected.to contain_murano_config('networking/create_router').with_value(true) }
it { is_expected.to contain_murano_config('networking/default_dns').with_value('["8.8.8.8"]') }
it { is_expected.to contain_murano_config('ssl/cert_file').with_value('/etc/murano/murano.crt') }
it { is_expected.to contain_murano_config('ssl/key_file').with_value('/etc/murano/murano.key') }
it { is_expected.to contain_murano_config('ssl/ca_file').with_value('/etc/murano/ca.crt') }
it { is_expected.to_not contain_exec('murano-dbmanage') }
end
context 'on Debian platforms' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian'
}
end
it_configures 'with default parameters'
it_configures 'with parameters override'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'with default parameters'
it_configures 'with parameters override'
end
end

View File

@ -0,0 +1,41 @@
require 'spec_helper'
describe 'murano::policy' do
shared_examples_for 'murano policies' do
let :params do
{
:policy_path => '/etc/murano/policy.json',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
}
}
end
it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar'
})
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'murano policies'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'murano policies'
end
end