Make cinder a soft dependency

Add the parameter `install_cinder_client` to nova::api to make the
inclusion of the cinder::client class optional. This makes cinder a soft
dependency and the puppet-cinder module no longer has to be present in
environments where cinder is not deployed.
The default value is true, so the behaviour of the nova::api class does
not change.

Patch 2: Fix indentation in documentation

Change-Id: Ibc974cb49448b86885eaf8b817489d3345901a5f
Closes-bug: #1511316
Signed-off-by: Romanos Skiadas <rom.skiad@gmail.com>
This commit is contained in:
Romanos Skiadas 2016-08-02 19:21:47 +03:00
parent a8e3d482be
commit 846b8bc218
2 changed files with 20 additions and 2 deletions

View File

@ -195,6 +195,10 @@
# (optional) Length of generated instance admin passwords (integer value)
# Defaults to $::os_service_default
#
# [*install_cinder_client*]
# (optional) Whether the cinder::client class should be used to install the cinder client.
# Defaults to true
#
# DEPRECATED
#
# [*keystone_ec2_url*]
@ -293,6 +297,7 @@ class nova::api(
$enable_network_quota = $::os_service_default,
$enable_instance_password = $::os_service_default,
$password_length = $::os_service_default,
$install_cinder_client = true,
# DEPRECATED PARAMETER
$conductor_workers = undef,
$ec2_listen_port = undef,
@ -311,9 +316,13 @@ class nova::api(
include ::nova::deps
include ::nova::db
include ::nova::policy
include ::cinder::client
include ::nova::keystone::authtoken
if $install_cinder_client {
include ::cinder::client
Class['cinder::client'] ~> Nova::Generic_service['api']
}
if $osapi_v3 {
warning('osapi_v3 is deprecated, has no effect and will be removed in a future release.')
}
@ -421,7 +430,6 @@ class nova::api(
ensure_package => $ensure_package,
package_name => $::nova::params::api_package_name,
service_name => $::nova::params::api_service_name,
subscribe => Class['cinder::client'],
}
nova_config {

View File

@ -15,6 +15,7 @@ describe 'nova::api' do
context 'with default parameters' do
it { is_expected.to contain_class('nova::keystone::authtoken') }
it { is_expected.to contain_class('cinder::client').that_notifies('Nova::Generic_service[api]') }
it 'installs nova-api package and service' do
is_expected.to contain_service('nova-api').with(
@ -330,6 +331,15 @@ describe 'nova::api' do
end
end
context 'when disabling cinder client installation' do
before do
params.merge!({ :install_cinder_client => false })
end
it { is_expected.to_not contain_class('cinder::client') }
end
context 'when service_name is not valid' do
before do
params.merge!({ :service_name => 'foobar' })