Making instance_name_template configurable.
This will allow users to configure the value. The parameter will be added only if required, and exposed via heat templates. instance_name_template is a template string to be used to generate instance names. Added spec tests for instance_name_template Change-Id: Ic2b9b9f34521afbb2744690945230e14052f84d2
This commit is contained in:
@@ -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,
|
||||
|
@@ -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!({
|
||||
|
Reference in New Issue
Block a user