add missing attribute for sqlite

Closes-Bug: 1293814
Change-Id: I3f314f120ee25ed6ba1f89c6b50144780284bdb9
This commit is contained in:
KE ZHU 2014-04-06 17:48:30 -04:00
parent ff1c6e207b
commit 92590f9d85
4 changed files with 23 additions and 1 deletions

View File

@ -67,6 +67,7 @@ when 'fedora', 'centos', 'redhat'
'mysql_python_packages' => ['MySQL-python'],
'db2_python_packages' => %w{python-ibm-db python-ibm-db-django python-ibm-db-sa},
'postgresql_python_packages' => ['python-psycopg2'],
'sqlite_python_packages' => [],
'horizon_packages' => ['openstack-dashboard'],
'memcache_python_packages' => ['python-memcached'],
'package_overrides' => ''
@ -86,6 +87,7 @@ when 'suse'
default['openstack']['dashboard']['platform'] = {
'mysql_python_packages' => ['python-mysql'],
'postgresql_python_packages' => ['python-psycopg2'],
'sqlite_python_packages' => [],
'horizon_packages' => ['openstack-dashboard'],
'memcache_python_packages' => ['python-python-memcached'],
'package_overrides' => ''
@ -102,6 +104,7 @@ when 'ubuntu'
'mysql_python_packages' => ['python-mysqldb'],
'postgresql_python_packages' => ['python-psycopg2'],
'memcache_python_packages' => ['python-memcache'],
'sqlite_python_packages' => [],
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
}
# lessc became node-less in 12.10

View File

@ -125,7 +125,8 @@ execute 'openstack-dashboard syncdb' do
action :run
only_if do
node['openstack']['dashboard']['session_backend'] == 'sql' &&
node['openstack']['db']['dashboard']['migrate']
node['openstack']['db']['dashboard']['migrate'] ||
db_info['service_type'] == 'sqlite'
end
end

View File

@ -164,6 +164,13 @@ describe 'openstack-dashboard::server' do
expect(chef_run).to render_file(file.name).with_content('OPENSTACK_KEYSTONE_URL = "http://127.0.0.1:5000/v2.0"')
expect(chef_run).to render_file(file.name).with_content('OPENSTACK_KEYSTONE_ADMIN_URL = "http://127.0.0.1:35357/v2.0"')
end
it 'supports sqlite as database backend' do
node.set['openstack']['db']['dashboard']['service_type'] = 'sqlite'
node.set['openstack']['db']['dashboard']['db_name'] = 'jabba'
expect(chef_run).to render_file(file.name).with_content('\'ENGINE\': \'django.db.backends.sqlite3\'')
expect(chef_run).to render_file(file.name).with_content('\'NAME\': \'jabba\'')
end
end
describe 'openstack-dashboard syncdb' do
@ -195,6 +202,14 @@ describe 'openstack-dashboard::server' do
environment: sync_db_environment
)
end
it 'executes when database backend is sqlite' do
node.set['openstack']['db']['dashboard']['service_type'] = 'sqlite'
expect(chef_run_session_sql).to run_execute(sync_db_cmd).with(
cwd: node['openstack']['dashboard']['django_path'],
environment: sync_db_environment
)
end
end
describe 'certs' do

View File

@ -472,6 +472,7 @@ SECURITY_GROUP_RULES = {
}
<% django_backends = {'mysql' => 'django.db.backends.mysql',
'sqlite' => 'django.db.backends.sqlite3',
'postgresql' => 'django.db.backends.postgresql_psycopg2',
'db2' => 'ibm_db_django'}
engine = django_backends[@db_info['service_type']] %>
@ -483,9 +484,11 @@ DATABASES = {
'default': {
'ENGINE': '<%= engine %>',
'NAME': '<%= @db_info["db_name"] %>',
<% unless @db_info['service_type'] == 'sqlite' %>
'USER': '<%= node["openstack"]["db"]["dashboard"]["username"] %>',
'PASSWORD': '<%= @db_pass %>',
'HOST': '<%= @db_info["host"] %>',
<% end %>
'default-character-set': 'utf8'
},
}