Merge "Making instance_name_template configurable."

This commit is contained in:
Jenkins 2015-11-06 09:07:28 +00:00 committed by Gerrit Code Review
commit aabb4e9c54
2 changed files with 28 additions and 0 deletions

View File

@ -110,6 +110,10 @@
# Class instead.
# Defaults to undef
#
# [*instance_name_template*]
# (optional) Template string to be used to generate instance names
# Defaults to undef
#
# [*sync_db*]
# (optional) Run nova-manage db sync on api nodes after installing the package.
# Defaults to true
@ -194,6 +198,7 @@ class nova::api(
'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory',
$validate = false,
$validation_options = {},
$instance_name_template = undef,
# DEPRECATED PARAMETER
$auth_protocol = 'http',
$auth_port = 35357,
@ -220,6 +225,16 @@ class nova::api(
warning('The conductor_workers parameter is deprecated and has no effect. Use workers parameter of nova::conductor class instead.')
}
if $instance_name_template {
nova_config {
'DEFAULT/instance_name_template': value => $instance_name_template;
}
} else {
nova_config{
'DEFAULT/instance_name_template': ensure => absent;
}
}
nova::generic_service { 'api':
enabled => $enabled,
manage_service => $manage_service,

View File

@ -56,6 +56,8 @@ describe 'nova::api' do
'keystone_authtoken/admin_password').with_value('passw0rd').with_secret(true)
end
it { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')}
it 'configures various stuff' do
is_expected.to contain_nova_config('DEFAULT/ec2_listen').with('value' => '0.0.0.0')
is_expected.to contain_nova_config('DEFAULT/ec2_listen_port').with('value' => '8773')
@ -270,6 +272,17 @@ describe 'nova::api' do
it { is_expected.to contain_nova_config('database/idle_timeout').with_value('30') }
end
context 'with custom instance_name_template' do
before do
params.merge!({
:instance_name_template => 'instance-%08x',
})
end
it 'configures instance_name_template' do
is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_value('instance-%08x');
end
end
context 'with custom keystone identity_uri' do
before do
params.merge!({