placement: Remove service deployment from puppet-nova

Deprecated by Iefade0f0a9bb0ab83c0aba6c5f263bde240cf9a2 in Stein this
can now be removed in Train.

Depends-On: https://review.opendev.org/655170
Change-Id: I5b8a8173b4434442622ad0f5a018f6238a2648e2
This commit is contained in:
Lee Yarwood 2019-02-22 12:43:49 +00:00 committed by Piotr Kopec
parent 767516c21f
commit c7d1f40c3f
13 changed files with 7 additions and 1016 deletions

View File

@ -70,16 +70,6 @@
# [*database_pool_timeout*]
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*placement_database_connection*]
# (optional) Connection url to connect to placement database.
# Defaults to $::os_service_default
#
# [*placement_slave_connection*]
# (optional) Connection url to connect to placement slave database (read-only).
# Defaults to $::os_service_default
class nova::db (
$database_db_max_retries = $::os_service_default,
@ -94,30 +84,17 @@ class nova::db (
$database_retry_interval = $::os_service_default,
$database_max_overflow = $::os_service_default,
$database_pool_timeout = $::os_service_default,
# DEPRECATED PARAMETERS
$placement_database_connection = $::os_service_default,
$placement_slave_connection = $::os_service_default,
) {
include ::nova::deps
include ::nova::params
if $placement_database_connection {
warning('nova::db::placement_database_connection is deprecated and will be removed in a future release')
}
if $placement_slave_connection {
warning('nova::db::placement_slave_connection is deprecated and will be removed in a future release')
}
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use nova::<myparam> first the nova::db::<myparam>
$database_connection_real = pick($::nova::database_connection, $database_connection)
$slave_connection_real = pick($::nova::slave_connection, $slave_connection)
$api_database_connection_real = pick($::nova::api_database_connection, $api_database_connection)
$api_slave_connection_real = pick($::nova::api_slave_connection, $api_slave_connection)
$placement_database_connection_real = pick($::nova::placement_database_connection, $placement_database_connection)
$placement_slave_connection_real = pick($::nova::placement_slave_connection, $placement_slave_connection)
$database_idle_timeout_real = pick($::nova::database_idle_timeout, $database_idle_timeout)
$database_min_pool_size_real = pick($::nova::database_min_pool_size, $database_min_pool_size)
$database_max_pool_size_real = pick($::nova::database_max_pool_size, $database_max_pool_size)
@ -156,16 +133,4 @@ class nova::db (
}
if !is_service_default($placement_database_connection_real) {
validate_legacy(Oslo::Dbconn, 'validate_re', $placement_database_connection_real,
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
nova_config {
'placement_database/connection': value => $placement_database_connection_real, secret => true;
'placement_database/slave_connection': value => $placement_slave_connection_real, secret => true;
}
}
}

View File

@ -1,67 +0,0 @@
# == Class: nova::db::mysql_placement
#
# Class that configures mysql for the nova_placement database.
#
# This class is deprecated and will be removed in a future release in favour of
# the puppet-placement module.
#
# === Parameters:
#
# DEPRECATED PARAMETERS
#
# [*password*]
# (Required) Password to use for the nova user
#
# [*dbname*]
# (Optional) The name of the database
# Defaults to 'nova_placement'
#
# [*user*]
# (Optional) The mysql user to create
# Defaults to 'nova_placement'
#
# [*host*]
# (Optional) The IP address of the mysql server
# Defaults to '127.0.0.1'
#
# [*charset*]
# (Optional) The charset to use for the nova database
# Defaults to 'utf8'
#
# [*collate*]
# (Optional) The collate to use for the nova database
# Defaults to 'utf8_general_ci'
#
# [*allowed_hosts*]
# (Optional) Additional hosts that are allowed to access this DB
# Defaults to undef
#
class nova::db::mysql_placement(
# DEPRECATED PARAMETERS
$password,
$dbname = 'nova_placement',
$user = 'nova_placement',
$host = '127.0.0.1',
$charset = 'utf8',
$collate = 'utf8_general_ci',
$allowed_hosts = undef,
) {
warning('nova::db::mysql_placement is deprecated and will be removed in a future release')
include ::nova::deps
::openstacklib::db::mysql { 'nova_placement':
user => $user,
password_hash => mysql::password($password),
dbname => $dbname,
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
}
Anchor['nova::db::begin']
~> Class['nova::db::mysql_placement']
~> Anchor['nova::db::end']
}

View File

@ -400,14 +400,6 @@
#
# DEPRECATED PARAMETERS
#
# [*placement_database_connection*]
# (optional) Connection url for the placement database.
# Defaults to undef.
#
# [*placement_slave_connection*]
# (optional) Connection url to connect to placement slave database (read-only).
# Defaults to undef.
#
# [*notify_api_faults*]
# (optional) If set, send api.fault notifications on caught
# exceptions in the API service
@ -515,8 +507,6 @@ class nova(
$my_ip = $::os_service_default,
$cross_az_attach = $::os_service_default,
# DEPRECATED PARAMETERS
$placement_database_connection = undef,
$placement_slave_connection = undef,
$notify_api_faults = undef,
$image_service = undef,
$notify_on_api_faults = undef,
@ -528,14 +518,6 @@ class nova(
# maintain backward compatibility
include ::nova::db
if $placement_database_connection {
warning('nova::placement_database_connection is deprecated and will be removed in a future release')
}
if $placement_slave_connection {
warning('nova::placement_slave_connection is deprecated and will be removed in a future release')
}
if $use_ipv6 {
warning('nova::use_ipv6 is deprecated and will be removed in a future release')
}

View File

@ -1,101 +0,0 @@
# == Class: nova::keystone::auth_placement
#
# Creates nova placement api endpoints and service account in keystone
#
# This class is deprecated and will be removed in a future release in favour of
# the puppet-placement module.
# === Parameters:
#
# DEPRECATED PARAMETERS
#
# [*password*]
# (Required) Password to create for the service user
#
# [*auth_name*]
# (Optional) The name of the placement service user
# Defaults to 'placement'
#
# [*service_name*]
# (Optional) Name of the service.
# Defaults to 'placement'.
#
# [*service_description*]
# (Optional) Description for keystone service.
# Defaults to 'Openstack Placement Service'.
#
# [*public_url*]
# (Optional) The endpoint's public url.
# Defaults to 'http://127.0.0.1/placement'
#
# [*internal_url*]
# (Optional) The endpoint's internal url.
# Defaults to 'http://127.0.0.1/placement'
#
# [*admin_url*]
# (Optional) The endpoint's admin url.
# Defaults to 'http://127.0.0.1/placement'
#
# [*region*]
# (Optional) The region in which to place the endpoints
# Defaults to 'RegionOne'
#
# [*tenant*]
# (Optional) The tenant to use for the nova service user
# Defaults to 'services'
#
# [*email*]
# (Optional) The email address for the nova service user
# Defaults to 'placement@localhost'
#
# [*configure_endpoint*]
# (Optional) Whether to create the endpoint.
# Defaults to true
#
# [*configure_user*]
# (Optional) Whether to create the service user.
# Defaults to true
#
# [*configure_user_role*]
# (Optional) Whether to configure the admin role for the service user.
# Defaults to true
#
class nova::keystone::auth_placement(
# DEPRECATED PARAMETERS
$password,
$auth_name = 'placement',
$service_name = 'placement',
$service_description = 'Openstack Placement Service',
$region = 'RegionOne',
$tenant = 'services',
$email = 'placement@localhost',
$public_url = $::nova::params::placement_public_url,
$internal_url = $::nova::params::placement_internal_url,
$admin_url = $::nova::params::placement_admin_url,
$configure_endpoint = true,
$configure_user = true,
$configure_user_role = true,
) inherits nova::params {
warning('nova::keystone::auth_placement is deprecated and will be removed in a future release')
include ::nova::deps
keystone::resource::service_identity { 'placement':
configure_user => $configure_user,
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
service_type => 'placement',
service_description => $service_description,
service_name => $service_name,
region => $region,
auth_name => $auth_name,
password => $password,
email => $email,
tenant => $tenant,
public_url => $public_url,
admin_url => $admin_url,
internal_url => $internal_url,
}
}

View File

@ -12,7 +12,6 @@ class nova::params {
'RedHat': {
# package names
$api_package_name = 'openstack-nova-api'
$placement_package_name = 'openstack-nova-placement-api'
$cells_package_name = 'openstack-nova-cells'
$common_package_name = 'openstack-nova-common'
$python_package_name = "python${pyvers}-nova"
@ -38,7 +37,6 @@ class nova::params {
$compute_service_name = 'openstack-nova-compute'
$conductor_service_name = 'openstack-nova-conductor'
$consoleauth_service_name = 'openstack-nova-consoleauth'
$placement_service_name = 'httpd'
$libvirt_service_name = 'libvirtd'
$libvirt_guests_service_name = 'libvirt-guests'
$virtlock_service_name = 'virtlockd'
@ -55,11 +53,6 @@ class nova::params {
$nova_wsgi_script_path = '/var/www/cgi-bin/nova'
$nova_api_wsgi_script_source = '/usr/bin/nova-api-wsgi'
$nova_metadata_wsgi_script_source = '/usr/bin/nova-metadata-wsgi'
$placement_public_url = 'http://127.0.0.1/placement'
$placement_internal_url = 'http://127.0.0.1/placement'
$placement_admin_url = 'http://127.0.0.1/placement'
$placement_wsgi_script_source = '/usr/bin/nova-placement-api'
$placement_httpd_config_file = '/etc/httpd/conf.d/00-nova-placement-api.conf'
case $::operatingsystem {
'RedHat', 'CentOS', 'Scientific', 'OracleLinux': {
if (versioncmp($::operatingsystemmajrelease, '7') < 0) {
@ -86,7 +79,6 @@ class nova::params {
'Debian': {
# package names
$api_package_name = 'nova-api'
$placement_package_name = 'nova-placement-api'
$cells_package_name = 'nova-cells'
$common_package_name = 'nova-common'
$python_package_name = "python${pyvers}-nova"
@ -118,8 +110,6 @@ class nova::params {
$nova_wsgi_script_path = '/usr/lib/cgi-bin/nova'
$nova_api_wsgi_script_source = '/usr/bin/nova-api-wsgi'
$nova_metadata_wsgi_script_source = '/usr/bin/nova-metadata-wsgi'
$placement_wsgi_script_source = '/usr/bin/nova-placement-api'
$placement_httpd_config_file = '/etc/apache2/sites-available/nova-placement-api.conf'
# debian specific nova config
$root_helper = 'sudo nova-rootwrap'
$lock_path = '/var/lock/nova'
@ -133,10 +123,6 @@ class nova::params {
$special_service_provider = undef
$virtlock_service_name = 'virtlockd'
$virtlog_service_name = 'virtlogd'
$placement_service_name = 'nova-placement-api'
$placement_public_url = 'http://127.0.0.1'
$placement_internal_url = 'http://127.0.0.1'
$placement_admin_url = 'http://127.0.0.1'
}
default: {
$spicehtml5proxy_package_name = 'nova-spiceproxy'
@ -147,10 +133,6 @@ class nova::params {
$special_service_provider = undef
$virtlock_service_name = 'virtlockd'
$virtlog_service_name = 'virtlogd'
$placement_service_name = 'httpd'
$placement_public_url = 'http://127.0.0.1/placement'
$placement_internal_url = 'http://127.0.0.1/placement'
$placement_admin_url = 'http://127.0.0.1/placement'
}
}
$libvirt_service_name = 'libvirtd'

View File

@ -1,11 +1,11 @@
# == Class: nova::placement
#
# Class for deploying Placement and configuring the [placement] section in nova.conf.
# Class for configuring the [placement] section in nova.conf.
#
# === Parameters:
#
# [*password*]
# (required) Password for connecting to Nova Placement API service in
# (required) Password for connecting to Placement API service in
# admin context through the OpenStack Identity service.
#
# [*auth_type*]
@ -13,22 +13,22 @@
# Defaults to 'password'
#
# [*project_name*]
# (optional) Project name for connecting to Nova Placement API service in
# (optional) Project name for connecting to Placement API service in
# admin context through the OpenStack Identity service.
# Defaults to 'services'
#
# [*project_domain_name*]
# (optional) Project Domain name for connecting to Nova Placement API service in
# (optional) Project Domain name for connecting to Placement API service in
# admin context through the OpenStack Identity service.
# Defaults to 'Default'
#
# [*user_domain_name*]
# (optional) User Domain name for connecting to Nova Placement API service in
# (optional) User Domain name for connecting to Placement API service in
# admin context through the OpenStack Identity service.
# Defaults to 'Default'
#
# [*region_name*]
# (optional) Region name for connecting to Nova Placement API service in admin context
# (optional) Region name for connecting to Placement API service in admin context
# through the OpenStack Identity service.
# Defaults to 'RegionOne'
#
@ -38,7 +38,7 @@
# Defaults to $::os_service_default
#
# [*username*]
# (optional) Username for connecting to Nova Placement API service in admin context
# (optional) Username for connecting to Placement API service in admin context
# through the OpenStack Identity service.
# Defaults to 'placement'
#
@ -54,28 +54,6 @@
# (optional) interface name used for getting the keystone endpoint for
# the placement API.
# Defaults to undef
#
# [*enabled*]
# (optional) Whether the nova placement api service will be run
# Defaults to true
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Only useful if $::nova::params::service_name is set to
# nova-placement-api.
# Defaults to true
#
# [*package_name*]
# (optional) The package name for nova placement.
# Defaults to $::nova::params::placement_package_name
#
# [*service_name*]
# (optional) The service name for the placement service.
# Defaults to $::nova::params::placement_service_name
#
# [*ensure_package*]
# (optional) The state of the nova placement package
# Defaults to 'present'
class nova::placement(
$password = false,
@ -89,30 +67,15 @@ class nova::placement(
$username = 'placement',
# DEPRECATED PARAMETERS
$os_interface = undef,
$enabled = true,
$manage_service = true,
$package_name = $::nova::params::placement_package_name,
$service_name = $::nova::params::placement_service_name,
$ensure_package = 'present',
) inherits nova::params {
include ::nova::deps
validate_legacy(Boolean, 'validate_bool', $enabled)
if $os_interface {
warning('nova::placement::os_interface is deprecated for removal, please use valid_interfaces instead.')
}
$valid_interfaces_real = pick($os_interface, $valid_interfaces)
class { '::nova::placement::service':
enabled => $enabled,
manage_service => $manage_service,
package_name => $package_name,
service_name => $service_name,
ensure_package => $ensure_package,
}
nova_config {
'placement/auth_type': value => $auth_type;
'placement/auth_url': value => $auth_url;

View File

@ -1,65 +0,0 @@
# == Class: nova::placement::service
#
# Class for deploying the Placement service.
#
# This class is deprecated and will be removed in a future release in favour of
# the puppet-placement module.
#
# === Parameters:
#
# DEPRECATED PARAMETERS
#
# [*enabled*]
# (optional) Whether the nova placement api service will be run
# Defaults to true
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Only useful if $::nova::params::service_name is set to
# nova-placement-api.
# Defaults to true
#
# [*package_name*]
# (optional) The package name for nova placement.
# Defaults to $::nova::params::placement_package_name
#
# [*service_name*]
# (optional) The service name for the placement service.
# Defaults to $::nova::params::placement_service_name
#
# [*ensure_package*]
# (optional) The state of the nova placement package
# Defaults to 'present'
#
class nova::placement::service(
# DEPRECATED PARAMETERS
$enabled = true,
$manage_service = true,
$package_name = $::nova::params::placement_package_name,
$service_name = $::nova::params::placement_service_name,
$ensure_package = 'present',
) inherits nova::params {
warning('nova::placement::service is deprecated and will be removed in a future release')
include ::nova::deps
assert_private()
validate_bool($enabled)
if $service_name == 'nova-placement-api' {
nova::generic_service { 'nova-placement-api':
enabled => $enabled,
manage_service => $manage_service,
package_name => $package_name,
service_name => $service_name,
ensure_package => $ensure_package,
}
} elsif $service_name == 'httpd' {
# we need to make sure nova-placement-api/uwsgi is stopped before trying to start apache
if ($::os_package_type == 'debian') {
Service['nova-placement-api'] -> Service[$service_name]
}
}
}

View File

@ -1,189 +0,0 @@
#
# Copyright (C) 2015 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 to serve Nova Placement API service.
# Serving Nova Placement API from apache is the recommended way to go for production
# because of limited performance for concurrent accesses.
#
# == Parameters
#
# DEPRECATED PARAMETERS
#
# [*servername*]
# The servername for the virtualhost.
# Optional. Defaults to $::fqdn
#
# [*api_port*]
# The port for Novai Placement API service.
# Optional. Defaults to 80
#
# [*bind_host*]
# The host/ip address Apache will listen on.
# Optional. Defaults to undef (listen on all ip addresses).
#
# [*path*]
# The prefix for the endpoint.
# Optional. Defaults to '/placement'
#
# [*ssl*]
# Use ssl ? (boolean)
# Optional. Defaults to true
#
# [*workers*]
# Number of WSGI workers to spawn.
# Optional. Defaults to $::os_workers
#
# [*priority*]
# (optional) The priority for the vhost.
# Defaults to '10'
#
# [*threads*]
# (optional) The number of threads for the vhost.
# Defaults to 1
#
# [*wsgi_process_display_name*]
# (optional) Name of the WSGI process display-name.
# Defaults to undef
#
# [*ensure_package*]
# (optional) Control the ensure parameter for the Nova Placement API package resource.
# Defaults to 'present'
#
# [*ssl_cert*]
# [*ssl_key*]
# [*ssl_chain*]
# [*ssl_ca*]
# [*ssl_crl_path*]
# [*ssl_crl*]
# [*ssl_certs_dir*]
# apache::vhost ssl parameters.
# Optional. Default to apache::vhost 'ssl_*' defaults.
#
# [*access_log_file*]
# The log file name for the virtualhost.
# Optional. Defaults to false.
#
# [*access_log_format*]
# The log format for the virtualhost.
# Optional. Defaults to false.
#
# [*error_log_file*]
# The error log file name for the virtualhost.
# Optional. Defaults to undef.
#
# [*custom_wsgi_process_options*]
# (optional) gives you the opportunity to add custom process options or to
# overwrite the default options for the WSGI main process.
# eg. to use a virtual python environment for the WSGI process
# you could set it to:
# { python-path => '/my/python/virtualenv' }
# Defaults to {}
#
# == Examples
#
# include apache
#
# class { 'nova::wsgi::apache': }
#
class nova::wsgi::apache_placement (
$servername = $::fqdn,
$api_port = 80,
$bind_host = undef,
$path = '/placement',
$ssl = true,
$workers = $::os_workers,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_chain = undef,
$ssl_ca = undef,
$ssl_crl_path = undef,
$ssl_crl = undef,
$ssl_certs_dir = undef,
$wsgi_process_display_name = undef,
$threads = 1,
$priority = '10',
$ensure_package = 'present',
$access_log_file = false,
$access_log_format = false,
$error_log_file = undef,
$custom_wsgi_process_options = {},
) {
warning('nova::wsgi::apache_placement is deprecated and will be removed in a future release')
include ::nova::params
include ::apache
include ::apache::mod::wsgi
if $ssl {
include ::apache::mod::ssl
}
nova::generic_service { 'placement-api':
service_name => false,
package_name => $::nova::params::placement_package_name,
ensure_package => $ensure_package,
}
file { $::nova::params::placement_httpd_config_file:
ensure => present,
content => "#
# This file has been cleaned by Puppet.
#
# OpenStack Nova Placement API configuration has been moved to:
# - ${priority}-placement_wsgi.conf
#",
}
# Ubuntu requires nova-placement-api to be installed before apache to find wsgi script
Package<| title == 'nova-placement-api'|> -> Package<| title == 'httpd'|>
Package<| title == 'nova-placement-api' |>
-> File[$::nova::params::placement_httpd_config_file]
~> Service['httpd']
Service <| title == 'httpd' |> { tag +> 'nova-service' }
::openstacklib::wsgi::apache { 'placement_wsgi':
bind_host => $bind_host,
bind_port => $api_port,
group => 'nova',
path => $path,
priority => $priority,
servername => $servername,
ssl => $ssl,
ssl_ca => $ssl_ca,
ssl_cert => $ssl_cert,
ssl_certs_dir => $ssl_certs_dir,
ssl_chain => $ssl_chain,
ssl_crl => $ssl_crl,
ssl_crl_path => $ssl_crl_path,
ssl_key => $ssl_key,
threads => $threads,
user => 'nova',
workers => $workers,
wsgi_daemon_process => 'placement-api',
wsgi_process_display_name => $wsgi_process_display_name,
wsgi_process_group => 'placement-api',
wsgi_script_dir => $::nova::params::nova_wsgi_script_path,
wsgi_script_file => 'nova-placement-api',
wsgi_script_source => $::nova::params::placement_wsgi_script_source,
custom_wsgi_process_options => $custom_wsgi_process_options,
access_log_file => $access_log_file,
access_log_format => $access_log_format,
error_log_file => $error_log_file,
}
}

View File

@ -1,85 +0,0 @@
require 'spec_helper'
describe 'nova::db::mysql_placement' do
shared_examples_for 'nova::db::mysql_placement' do
let :pre_condition do
'include mysql::server'
end
let :required_params do
{ :password => "qwerty" }
end
context 'with only required params' do
let :params do
required_params
end
it { is_expected.to contain_openstacklib__db__mysql('nova_placement').with(
:user => 'nova_placement',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
context 'overriding allowed_hosts param to array' do
let :params do
{ :password => 'novapass',
:allowed_hosts => ['127.0.0.1','%'],
}.merge(required_params)
end
it { is_expected.to contain_openstacklib__db__mysql('nova_placement').with(
:user => 'nova_placement',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => ['127.0.0.1','%'],
)}
end
context 'overriding allowed_hosts param to string' do
let :params do
{ :password => 'novapass2',
:allowed_hosts => '192.168.1.1',
}.merge(required_params)
end
it { is_expected.to contain_openstacklib__db__mysql('nova_placement').with(
:user => 'nova_placement',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1',
)}
end
context 'when overriding charset' do
let :params do
{ :password => 'novapass',
:charset => 'latin1',
}.merge(required_params)
end
it { is_expected.to contain_openstacklib__db__mysql('nova_placement').with(
:charset => 'latin1',
)}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'nova::db::mysql_placement'
end
end
end

View File

@ -12,8 +12,6 @@ describe 'nova::db' do
it { should_not contain_nova_config('database/slave_connection') }
it { should_not contain_nova_config('api_database/connection') }
it { should_not contain_nova_config('api_database/slave_connection') }
it { should_not contain_nova_config('placement_database/connection') }
it { should_not contain_nova_config('placement_database/slave_connection') }
it { should_not contain_nova_config('database/idle_timeout') }
it { should_not contain_nova_config('database/min_pool_size') }
it { should_not contain_nova_config('database/max_pool_size') }
@ -30,8 +28,6 @@ describe 'nova::db' do
:slave_connection => 'mysql+pymysql://user:pass@slave/db1',
:api_database_connection => 'mysql+pymysql://user:pass@db/db2',
:api_slave_connection => 'mysql+pymysql://user:pass@slave/db2',
:placement_database_connection => 'mysql+pymysql://user:pass@db/db2',
:placement_slave_connection => 'mysql+pymysql://user:pass@slave/db2',
)
end
@ -50,8 +46,6 @@ describe 'nova::db' do
it { should contain_nova_config('api_database/connection').with_value('mysql+pymysql://user:pass@db/db2').with_secret(true) }
it { should contain_nova_config('api_database/slave_connection').with_value('mysql+pymysql://user:pass@slave/db2').with_secret(true) }
it { should contain_nova_config('placement_database/connection').with_value('mysql+pymysql://user:pass@db/db2').with_secret(true) }
it { should contain_nova_config('placement_database/slave_connection').with_value('mysql+pymysql://user:pass@slave/db2').with_secret(true) }
end
end

View File

@ -1,195 +0,0 @@
require 'spec_helper'
describe 'nova::keystone::auth_placement' do
let :params do
{ :password => 'placement_password' }
end
let :default_params do
{ :auth_name => 'placement',
:service_name => 'placement',
:region => 'RegionOne',
:tenant => 'services',
:email => 'placement@localhost' }
end
shared_examples 'nova::keystone::auth_placement' do
context 'with default parameters' do
it { is_expected.to contain_keystone_user('placement').with(
:ensure => 'present',
:password => 'placement_password'
)}
it { is_expected.to contain_keystone_user_role('placement@services').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Openstack Placement Service'
)}
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
:ensure => 'present',
:public_url => platform_params[:public_url],
:admin_url => platform_params[:admin_url],
:internal_url => platform_params[:internal_url]
)}
end
context 'when setting auth name' do
before do
params.merge!( :auth_name => 'foo' )
end
it { is_expected.to contain_keystone_user('foo').with(
:ensure => 'present',
:password => 'placement_password'
)}
it { is_expected.to contain_keystone_user_role('foo@services').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Openstack Placement Service'
)}
end
context 'when overriding endpoint parameters' do
before do
params.merge!(
:region => 'RegionTwo',
:public_url => 'https://10.0.0.1:9778',
:internal_url => 'https://10.0.0.3:9778',
:admin_url => 'https://10.0.0.2:9778',
)
end
it { is_expected.to contain_keystone_endpoint('RegionTwo/placement::placement').with(
:ensure => 'present',
:public_url => params[:public_url],
:internal_url => params[:internal_url],
:admin_url => params[:admin_url]
)}
end
describe 'when disabling endpoint configuration' do
before do
params.merge!( :configure_endpoint => false )
end
it { is_expected.to_not contain_keystone_endpoint('RegionOne/placement::placement') }
end
describe 'when disabling user configuration' do
before do
params.merge!( :configure_user => false )
end
it { is_expected.to_not contain_keystone_user('placement') }
it { is_expected.to contain_keystone_user_role('placement@services') }
it { is_expected.to contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Openstack Placement Service'
)}
end
describe 'when disabling user and user role configuration' do
let :params do
{
:configure_user => false,
:configure_user_role => false,
:password => 'placement_password'
}
end
it { is_expected.to_not contain_keystone_user('placement') }
it { is_expected.to_not contain_keystone_user_role('placement@services') }
it { is_expected.to contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Openstack Placement Service'
)}
end
describe 'when configuring nova-placement and the keystone endpoint' do
let :pre_condition do
"class { '::nova::keystone::authtoken':
password => 'secrete',
}
class { 'nova::api':}
include nova"
end
let :facts do
facts.merge({ :osfamily => "Debian"})
end
let :params do
{
:password => 'test'
}
end
end
describe 'when overriding service names' do
let :params do
{
:service_name => 'nova_service',
:password => 'placement_password'
}
end
it { is_expected.to contain_keystone_user('placement') }
it { is_expected.to contain_keystone_user_role('placement@services') }
it { is_expected.to contain_keystone_service('nova_service::placement') }
it { is_expected.to contain_keystone_endpoint('RegionOne/nova_service::placement') }
end
end
shared_examples 'nova::keystone::auth_placement on Debian' do
before do
facts.merge!( :os_package_type => 'debian' )
end
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
:ensure => 'present',
:public_url => platform_params[:public_url],
:admin_url => platform_params[:admin_url],
:internal_url => platform_params[:internal_url]
)}
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
if facts[:os_package_type] == 'debian'
{ :public_url => 'http://127.0.0.1',
:internal_url => 'http://127.0.0.1',
:admin_url => 'http://127.0.0.1' }
else
{ :public_url => 'http://127.0.0.1/placement',
:internal_url => 'http://127.0.0.1/placement',
:admin_url => 'http://127.0.0.1/placement' }
end
end
it_behaves_like 'nova::keystone::auth_placement'
if facts[:operatingsystem] == 'Debian'
it_behaves_like 'nova::keystone::auth_placement on Debian'
end
end
end
end

View File

@ -59,47 +59,6 @@ describe 'nova::placement' do
is_expected.to contain_nova_config('placement/auth_url').with_value(params[:auth_url])
end
end
context 'when settings service_name to httpd' do
before do
params.merge!(
:service_name => 'httpd',
)
end
it 'should not contain placement generic service' do
is_expected.to_not contain_nova__generic_service('nova-placement-api')
end
end
end
shared_examples 'nova::placement on Ubuntu' do
context 'with required parameters' do
it 'should not contain placement generic service' do
is_expected.to_not contain_nova__generic_service('nova-placement-api')
end
end
end
shared_examples 'nova::placement on Debian' do
before do
facts.merge!(
:os_package_type => 'debian',
)
end
context 'with required parameters' do
it 'should contain placement generic service' do
is_expected.to contain_nova__generic_service('nova-placement-api').with(
:enabled => true,
:manage_service => true,
:package_name => 'nova-placement-api',
:service_name => 'nova-placement-api',
:ensure_package => 'present'
)
end
end
end
on_supported_os({
@ -109,12 +68,7 @@ describe 'nova::placement' do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'nova::placement'
if facts[:osfamily] == 'Debian'
it_behaves_like "nova::placement on #{facts[:operatingsystem]}"
end
end
end
end

View File

@ -1,147 +0,0 @@
require 'spec_helper'
describe 'nova::wsgi::apache_placement' do
shared_examples_for 'apache serving nova with mod_wsgi' do
context 'with default parameters' do
let :pre_condition do
"include nova
class { '::nova::keystone::authtoken':
password => 'secrete',
}
"
end
it { is_expected.to contain_class('nova::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to contain_class('apache::mod::ssl') }
it { is_expected.to contain_nova__generic_service('placement-api').with(
:service_name => false,
:package_name => platform_params[:placement_package_name],
:ensure_package => 'present',
)}
it { is_expected.to contain_file(platform_params[:placement_httpd_config_file]) }
it { is_expected.to contain_openstacklib__wsgi__apache('placement_wsgi').with(
:bind_port => 80,
:group => 'nova',
:path => '/placement',
:servername => facts[:fqdn],
:ssl => true,
:threads => 1,
:user => 'nova',
:workers => facts[:os_workers],
:wsgi_daemon_process => 'placement-api',
:wsgi_process_group => 'placement-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-placement-api',
:wsgi_script_source => platform_params[:placement_wsgi_script_source],
:custom_wsgi_process_options => {},
:access_log_file => false,
:access_log_format => false,
:error_log_file => nil,
)}
end
context 'when overriding parameters using different ports' do
let :pre_condition do
"include nova
class { '::nova::keystone::authtoken':
password => 'secrete',
}
"
end
let :params do
{
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
:api_port => 12345,
:ssl => false,
:wsgi_process_display_name => 'placement-api',
:workers => 37,
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
:access_log_file => '/var/log/httpd/access_log',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log'
}
end
it { is_expected.to contain_class('nova::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to_not contain_class('apache::mod::ssl') }
it { is_expected.to contain_nova__generic_service('placement-api').with(
:service_name => false,
:package_name => platform_params[:placement_package_name],
:ensure_package => 'present',
)}
it { is_expected.to contain_file(platform_params[:placement_httpd_config_file]) }
it { is_expected.to contain_openstacklib__wsgi__apache('placement_wsgi').with(
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'nova',
:path => '/placement',
:servername => 'dummy.host',
:ssl => false,
:workers => 37,
:threads => 1,
:user => 'nova',
:wsgi_daemon_process => 'placement-api',
:wsgi_process_display_name => 'placement-api',
:wsgi_process_group => 'placement-api',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'nova-placement-api',
:wsgi_script_source => platform_params[:placement_wsgi_script_source],
:custom_wsgi_process_options => {
'python_path' => '/my/python/path',
},
:access_log_file => '/var/log/httpd/access_log',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log'
)}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:os_workers => 42,
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:httpd_service_name => 'apache2',
:httpd_ports_file => '/etc/apache2/ports.conf',
:wsgi_script_path => '/usr/lib/cgi-bin/nova',
:placement_wsgi_script_source => '/usr/bin/nova-placement-api',
:placement_package_name => 'nova-placement-api',
:placement_httpd_config_file => '/etc/apache2/sites-available/nova-placement-api.conf',
}
when 'RedHat'
{
:httpd_service_name => 'httpd',
:httpd_ports_file => '/etc/httpd/conf/ports.conf',
:wsgi_script_path => '/var/www/cgi-bin/nova',
:placement_wsgi_script_source => '/usr/bin/nova-placement-api',
:placement_package_name => 'openstack-nova-placement-api',
:placement_httpd_config_file => '/etc/httpd/conf.d/00-nova-placement-api.conf',
}
end
end
it_behaves_like 'apache serving nova with mod_wsgi'
end
end
end