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.
|
# Class instead.
|
||||||
# Defaults to undef
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
|
# [*instance_name_template*]
|
||||||
|
# (optional) Template string to be used to generate instance names
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
# [*sync_db*]
|
# [*sync_db*]
|
||||||
# (optional) Run nova-manage db sync on api nodes after installing the package.
|
# (optional) Run nova-manage db sync on api nodes after installing the package.
|
||||||
# Defaults to true
|
# Defaults to true
|
||||||
@@ -194,6 +198,7 @@ class nova::api(
|
|||||||
'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory',
|
'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory',
|
||||||
$validate = false,
|
$validate = false,
|
||||||
$validation_options = {},
|
$validation_options = {},
|
||||||
|
$instance_name_template = undef,
|
||||||
# DEPRECATED PARAMETER
|
# DEPRECATED PARAMETER
|
||||||
$auth_protocol = 'http',
|
$auth_protocol = 'http',
|
||||||
$auth_port = 35357,
|
$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.')
|
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':
|
nova::generic_service { 'api':
|
||||||
enabled => $enabled,
|
enabled => $enabled,
|
||||||
manage_service => $manage_service,
|
manage_service => $manage_service,
|
||||||
|
@@ -56,6 +56,8 @@ describe 'nova::api' do
|
|||||||
'keystone_authtoken/admin_password').with_value('passw0rd').with_secret(true)
|
'keystone_authtoken/admin_password').with_value('passw0rd').with_secret(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')}
|
||||||
|
|
||||||
it 'configures various stuff' do
|
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').with('value' => '0.0.0.0')
|
||||||
is_expected.to contain_nova_config('DEFAULT/ec2_listen_port').with('value' => '8773')
|
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') }
|
it { is_expected.to contain_nova_config('database/idle_timeout').with_value('30') }
|
||||||
end
|
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
|
context 'with custom keystone identity_uri' do
|
||||||
before do
|
before do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
|
Reference in New Issue
Block a user