Deprecate sql_* for database_*
Upstream change d5ae9ea70ed878e08e1d195f34c1989ecdd0b74f deprecated default sql_* options for a new [database] section. This deprecates the sql_ options and moves the new options into the [database] sub-section of the config file. If sql_* values are given, they should be used but give a deprecation warning. Change-Id: I05db83ace63399c0b2ebd63f74f5dc76ff5d3e9a
This commit is contained in:
@@ -41,7 +41,7 @@ To utilize the nova module's functionality you will need to declare multiple res
|
||||
|
||||
```puppet
|
||||
class { 'nova':
|
||||
sql_connection => 'mysql://nova:a_big_secret@127.0.0.1/nova?charset=utf8",
|
||||
database_connection => 'mysql://nova:a_big_secret@127.0.0.1/nova?charset=utf8",
|
||||
rabbit_userid => 'nova',
|
||||
rabbit_password => 'an_even_bigger_secret',
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
|
@@ -3,8 +3,8 @@
|
||||
#
|
||||
# ==Parameters
|
||||
#
|
||||
# [sql_connection] Connection url to use to connect to nova sql database.
|
||||
# [sql_idle_timeout] Timeout before idle sql connections are reaped.
|
||||
# [database_connection] Connection url to connect to nova database.
|
||||
# [database_idle_timeout] Timeout before idle db connections are reaped.
|
||||
# [image_service] Service used to search for and retrieve images. Optional.
|
||||
# Defaults to 'nova.image.local.LocalImageService'
|
||||
# [glance_api_servers] List of addresses for api servers. Optional.
|
||||
@@ -36,8 +36,11 @@ class nova(
|
||||
$ensure_package = 'present',
|
||||
# this is how to query all resources from our clutser
|
||||
$nova_cluster_id='localcluster',
|
||||
# note: sql_* deprecated for database_*
|
||||
$sql_connection = false,
|
||||
$sql_idle_timeout = '3600',
|
||||
$sql_idle_timeout = false,
|
||||
$database_connection = false,
|
||||
$database_idle_timeout = 3600,
|
||||
$rpc_backend = 'nova.openstack.common.rpc.impl_kombu',
|
||||
$image_service = 'nova.image.glance.GlanceImageService',
|
||||
# these glance params should be optional
|
||||
@@ -147,22 +150,35 @@ class nova(
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
|
||||
# both the sql_connection and rabbit_host are things
|
||||
# that may need to be collected from a remote host
|
||||
if $sql_connection {
|
||||
if($sql_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
require 'mysql::python'
|
||||
} elsif($sql_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
warning('sql_connection deprecated for database_connection')
|
||||
$database_connection_real = $sql_connection
|
||||
} else {
|
||||
$database_connection_real = $database_connection
|
||||
}
|
||||
|
||||
} elsif($sql_connection =~ /sqlite:\/\//) {
|
||||
if $sql_idle_timeout {
|
||||
warning('sql_idle_timeout deprecated for database_idle_timeout')
|
||||
$database_idle_timeout_real = $sql_idle_timeout
|
||||
} else {
|
||||
$database_idle_timeout_real = $database_idle_timeout
|
||||
}
|
||||
|
||||
# both the database_connection and rabbit_host are things
|
||||
# that may need to be collected from a remote host
|
||||
if $database_connection_real {
|
||||
if($database_connection_real =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
require 'mysql::python'
|
||||
} elsif($database_connection_real =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
|
||||
|
||||
} elsif($database_connection_real =~ /sqlite:\/\//) {
|
||||
|
||||
} else {
|
||||
fail("Invalid db connection ${sql_connection}")
|
||||
fail("Invalid db connection ${database_connection_real}")
|
||||
}
|
||||
nova_config {
|
||||
'DEFAULT/sql_connection': value => $sql_connection, secret => true;
|
||||
'DEFAULT/sql_idle_timeout': value => $sql_idle_timeout;
|
||||
'database/connection': value => $database_connection_real, secret => true;
|
||||
'database/idle_timeout': value => $database_idle_timeout_real;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,8 +54,8 @@ describe 'nova' do
|
||||
'refreshonly' => true
|
||||
)}
|
||||
|
||||
it { should_not contain_nova_config('DEFAULT/sql_connection') }
|
||||
it { should_not contain_nova_config('DEFAULT/sql_idle_timeout').with_value('3600') }
|
||||
it { should_not contain_nova_config('database/connection') }
|
||||
it { should_not contain_nova_config('database/idle_timeout').with_value('3600') }
|
||||
|
||||
it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.glance.GlanceImageService') }
|
||||
it { should contain_nova_config('DEFAULT/glance_api_servers').with_value('localhost:9292') }
|
||||
@@ -84,8 +84,8 @@ describe 'nova' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
'sql_connection' => 'mysql://user:pass@db/db',
|
||||
'sql_idle_timeout' => '30',
|
||||
'database_connection' => 'mysql://user:pass@db/db',
|
||||
'database_idle_timeout' => '30',
|
||||
'verbose' => true,
|
||||
'debug' => true,
|
||||
'logdir' => '/var/log/nova2',
|
||||
@@ -105,8 +105,8 @@ describe 'nova' do
|
||||
|
||||
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_nova_config('DEFAULT/sql_connection').with_value('mysql://user:pass@db/db').with_secret(true) }
|
||||
it { should contain_nova_config('DEFAULT/sql_idle_timeout').with_value('30') }
|
||||
it { should contain_nova_config('database/connection').with_value('mysql://user:pass@db/db').with_secret(true) }
|
||||
it { should contain_nova_config('database/idle_timeout').with_value('30') }
|
||||
|
||||
it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.local.LocalImageService') }
|
||||
it { should_not contain_nova_config('DEFAULT/glance_api_servers') }
|
||||
@@ -130,6 +130,19 @@ describe 'nova' do
|
||||
|
||||
end
|
||||
|
||||
describe 'with deprecated sql parameters' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
'sql_connection' => 'mysql://user:pass@db/db',
|
||||
'sql_idle_timeout' => '30'
|
||||
}
|
||||
end
|
||||
it { should contain_nova_config('database/connection').with_value('mysql://user:pass@db/db').with_secret(true) }
|
||||
it { should contain_nova_config('database/idle_timeout').with_value('30') }
|
||||
end
|
||||
|
||||
|
||||
describe 'with some others parameters supplied' do
|
||||
|
||||
let :params do
|
||||
@@ -177,8 +190,8 @@ describe 'nova' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
'sql_connection' => 'mysql://user:pass@db/db',
|
||||
'sql_idle_timeout' => '30',
|
||||
'database_connection' => 'mysql://user:pass@db/db',
|
||||
'database_idle_timeout' => '30',
|
||||
'verbose' => true,
|
||||
'debug' => true,
|
||||
'logdir' => '/var/log/nova2',
|
||||
@@ -194,8 +207,8 @@ describe 'nova' do
|
||||
|
||||
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_nova_config('DEFAULT/sql_connection').with_value('mysql://user:pass@db/db') }
|
||||
it { should contain_nova_config('DEFAULT/sql_idle_timeout').with_value('30') }
|
||||
it { should contain_nova_config('database/connection').with_value('mysql://user:pass@db/db') }
|
||||
it { should contain_nova_config('database/idle_timeout').with_value('30') }
|
||||
|
||||
it { should contain_nova_config('DEFAULT/image_service').with_value('nova.image.local.LocalImageService') }
|
||||
it { should_not contain_nova_config('DEFAULT/glance_api_servers') }
|
||||
|
30
tests/all.pp
30
tests/all.pp
@@ -92,15 +92,15 @@ class { 'glance::api':
|
||||
class { 'glance::backend::file': }
|
||||
|
||||
class { 'glance::registry':
|
||||
verbose => true,
|
||||
debug => true,
|
||||
auth_type => 'keystone',
|
||||
auth_host => '127.0.0.1',
|
||||
auth_port => '35357',
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
sql_connection => "mysql://glance:${glance_db_password}@127.0.0.1/glance",
|
||||
verbose => true,
|
||||
debug => true,
|
||||
auth_type => 'keystone',
|
||||
auth_host => '127.0.0.1',
|
||||
auth_port => '35357',
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
database_connection => "mysql://glance:${glance_db_password}@127.0.0.1/glance",
|
||||
}
|
||||
|
||||
|
||||
@@ -123,12 +123,12 @@ class { 'nova::db::mysql':
|
||||
}
|
||||
|
||||
class { 'nova':
|
||||
sql_connection => "mysql://nova:${nova_db_password}@localhost/nova",
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => '127.0.0.1:9292',
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
database_connection => "mysql://nova:${nova_db_password}@localhost/nova",
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => '127.0.0.1:9292',
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
}
|
||||
|
||||
class { 'nova::api':
|
||||
|
@@ -46,8 +46,8 @@ node /controller/ {
|
||||
# export all of the things that will be needed by the clients
|
||||
@@nova_config { 'rabbit_hosts': value => $controller_host }
|
||||
Nova_config <| title == 'rabbit_hosts' |>
|
||||
@@nova_config { 'sql_connection': value => $nova_db }
|
||||
Nova_config <| title == 'sql_connection' |>
|
||||
@@nova_config { 'database_connection': value => $nova_db }
|
||||
Nova_config <| title == 'database_connection' |>
|
||||
@@nova_config { 'glance_api_servers': value => $glance_api_servers }
|
||||
Nova_config <| title == 'glance_api_servers' |>
|
||||
|
||||
@@ -112,15 +112,15 @@ node /controller/ {
|
||||
class { 'glance::backend::file': }
|
||||
|
||||
class { 'glance::registry':
|
||||
verbose => true,
|
||||
debug => true,
|
||||
auth_type => 'keystone',
|
||||
auth_host => '127.0.0.1',
|
||||
auth_port => '35357',
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
sql_connection => "mysql://glance:${glance_db_password}@127.0.0.1/glance",
|
||||
verbose => true,
|
||||
debug => true,
|
||||
auth_type => 'keystone',
|
||||
auth_host => '127.0.0.1',
|
||||
auth_port => '35357',
|
||||
keystone_tenant => 'services',
|
||||
keystone_user => 'glance',
|
||||
keystone_password => $glance_user_password,
|
||||
database_connection => "mysql://glance:${glance_db_password}@127.0.0.1/glance",
|
||||
}
|
||||
|
||||
|
||||
@@ -144,14 +144,14 @@ node /controller/ {
|
||||
}
|
||||
|
||||
class { 'nova':
|
||||
sql_connection => false,
|
||||
database_connection => false,
|
||||
# this is false b/c we are exporting
|
||||
rabbit_hosts => false,
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => false,
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
rabbit_hosts => false,
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => false,
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
}
|
||||
|
||||
class { 'nova::api':
|
||||
@@ -210,15 +210,15 @@ node /controller/ {
|
||||
node /compute/ {
|
||||
|
||||
class { 'nova':
|
||||
# set sql and rabbit to false so that the resources will be collected
|
||||
sql_connection => false,
|
||||
rabbit_hosts => false,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => false,
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
admin_password => $nova_user_password,
|
||||
# set db and rabbit to false so that the resources will be collected
|
||||
database_connection => false,
|
||||
rabbit_hosts => false,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => false,
|
||||
rabbit_userid => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
admin_password => $nova_user_password,
|
||||
}
|
||||
|
||||
class { 'nova::compute':
|
||||
|
@@ -76,7 +76,7 @@ node compute {
|
||||
}
|
||||
class { 'nova':
|
||||
verbose => $verbose,
|
||||
sql_connection => "mysql://${db_username}:${db_password}@${db_host}/${db_name}",
|
||||
database_connection => "mysql://${db_username}:${db_password}@${db_host}/${db_name}",
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => $glance_api_servers,
|
||||
rabbit_hosts => $rabbit_hosts,
|
||||
|
Reference in New Issue
Block a user