From 0c8ae1d0b9f3e192c8faeeabc711484ebbef4e04 Mon Sep 17 00:00:00 2001 From: JJ Asghar Date: Thu, 27 Aug 2015 15:37:36 -0500 Subject: [PATCH] Initial Liberty Changes Metadata changes - Updated maintainer email - Updated the version rubocop updates remove db2 refs Change-Id: I5ff8ca0939f13e583f8d4ff75ff91a4805e78381 --- attributes/default.rb | 2 -- metadata.rb | 6 +++--- spec/apache2-server-redhat_spec.rb | 4 ++-- spec/apache2-server_spec.rb | 12 ++++++------ spec/horizon-redhat_spec.rb | 11 ++--------- spec/horizon_spec.rb | 21 ++++++++++----------- templates/default/local_settings.py.erb | 3 +-- 7 files changed, 24 insertions(+), 35 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 568d0db..b06e991 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -84,7 +84,6 @@ default['openstack']['dashboard']['webroot'] = '/' # Dashboard specific database packages # Put common ones here and platform specific ones below. default['openstack']['dashboard']['db_python_packages'] = { - db2: [], mysql: [], postgresql: [], sqlite: [] @@ -107,7 +106,6 @@ when 'rhel' default['openstack']['dashboard']['login_url'] = "#{node['openstack']['dashboard']['webroot']}auth/login/" default['openstack']['dashboard']['logout_url'] = "#{node['openstack']['dashboard']['webroot']}auth/logout/" default['openstack']['dashboard']['login_redirect_url'] = node['openstack']['dashboard']['webroot'] - default['openstack']['dashboard']['db_python_packages']['db2'] = ['python-ibm-db-django'] default['openstack']['dashboard']['platform'] = { 'horizon_packages' => ['openstack-dashboard'], 'memcache_python_packages' => ['python-memcached'], diff --git a/metadata.rb b/metadata.rb index 2d2cf64..c6d3c0f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,10 +1,10 @@ name 'openstack-dashboard' maintainer 'openstack-chef' -maintainer_email 'opscode-chef-openstack@googlegroups.com' +maintainer_email 'openstack-dev@lists.openstack.org' license 'Apache 2.0' description 'Installs/Configures the OpenStack Dashboard (Horizon)' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '11.0.0' +version '12.0.0' recipe 'openstack-dashboard::horizon', 'Sets up the Horizon dashboard.' recipe 'openstack-dashboard::apache2-server', 'Sets up an Apache `mod_wsgi` container to run the dashboard.' @@ -15,4 +15,4 @@ recipe 'openstack-dashboard::server', 'Sets up the Horizon dashboard and webserv end depends 'apache2', '~> 3.1' -depends 'openstack-common', '>= 11.1.0' +depends 'openstack-common', '>= 12.0.0' diff --git a/spec/apache2-server-redhat_spec.rb b/spec/apache2-server-redhat_spec.rb index 3f6cc37..b9d3afa 100644 --- a/spec/apache2-server-redhat_spec.rb +++ b/spec/apache2-server-redhat_spec.rb @@ -33,7 +33,7 @@ describe 'openstack-dashboard::apache2-server' do user: 'root', group: 'root', mode: 0644 - ) + ) end it 'creates horizon.key' do @@ -41,7 +41,7 @@ describe 'openstack-dashboard::apache2-server' do user: 'root', group: 'root', mode: 0640 - ) + ) end it 'notifies restore-selinux-context' do diff --git a/spec/apache2-server_spec.rb b/spec/apache2-server_spec.rb index 21f6198..1f826ac 100644 --- a/spec/apache2-server_spec.rb +++ b/spec/apache2-server_spec.rb @@ -150,7 +150,7 @@ describe 'openstack-dashboard::apache2-server' do user: 'root', group: 'root', mode: 0644 - ) + ) end context 'template content' do @@ -305,7 +305,7 @@ describe 'openstack-dashboard::apache2-server' do it 'sets the right Alias path for /static' do node.set['openstack']['dashboard']['static_path'] = 'static_path_value' - expect(chef_run).to render_file(file.name).with_content(/^\s+Alias \/static static_path_value$/) + expect(chef_run).to render_file(file.name).with_content(%r{^\s+Alias /static static_path_value$}) end %w(dash_path static_path).each do |dir_attribute| @@ -333,12 +333,12 @@ describe 'openstack-dashboard::apache2-server' do it 'sets de ErrorLog directive' do node.set['openstack']['dashboard']['error_log'] = 'error_log_value' - expect(chef_run).to render_file(file.name).with_content(/^\s*ErrorLog log_dir_value\/error_log_value$/) + expect(chef_run).to render_file(file.name).with_content(%r{^\s*ErrorLog log_dir_value/error_log_value$}) end it 'sets de CustomLog directive' do node.set['openstack']['dashboard']['access_log'] = 'access_log_value' - expect(chef_run).to render_file(file.name).with_content(/^\s*CustomLog log_dir_value\/access_log_value combined$/) + expect(chef_run).to render_file(file.name).with_content(%r{^\s*CustomLog log_dir_value/access_log_value combined$}) end end @@ -409,7 +409,7 @@ describe 'openstack-dashboard::apache2-server' do resource = chef_run.find_resource('execute', 'a2dissite 000-default.conf').to_hash expect(resource).to include( - action: 'run', + action: [:run], params: { enable: false, name: '000-default' @@ -421,7 +421,7 @@ describe 'openstack-dashboard::apache2-server' do resource = chef_run.find_resource('execute', 'a2ensite openstack-dashboard.conf').to_hash expect(resource).to include( - action: 'run', + action: [:run], params: { enable: true, notifies: [:reload, 'service[apache2]', :immediately], diff --git a/spec/horizon-redhat_spec.rb b/spec/horizon-redhat_spec.rb index 153b2f5..5620fd0 100644 --- a/spec/horizon-redhat_spec.rb +++ b/spec/horizon-redhat_spec.rb @@ -17,13 +17,6 @@ describe 'openstack-dashboard::horizon' do expect(chef_run).to upgrade_package('MySQL-python') end - it 'installs db2 python packages if explicitly told' do - node.set['openstack']['db']['dashboard']['service_type'] = 'db2' - %w(python-ibm-db python-ibm-db-django python-ibm-db-sa).each do |pkg| - expect(chef_run).to upgrade_package(pkg) - end - end - describe 'local_settings' do let(:file) { chef_run.template('/etc/openstack-dashboard/local_settings') } @@ -32,14 +25,14 @@ describe 'openstack-dashboard::horizon' do user: 'root', group: 'apache', mode: 0640 - ) + ) end it 'has urls set' do [ %r{^LOGIN_URL = '/auth/login/'$}, %r{^LOGOUT_URL = '/auth/logout/'$}, - /^LOGIN_REDIRECT_URL = '\/'$/ + %r{^LOGIN_REDIRECT_URL = '/'$} ].each do |line| expect(chef_run).to render_file(file.name).with_content(line) end diff --git a/spec/horizon_spec.rb b/spec/horizon_spec.rb index 2821787..1aef87c 100644 --- a/spec/horizon_spec.rb +++ b/spec/horizon_spec.rb @@ -32,7 +32,7 @@ describe 'openstack-dashboard::horizon' do user: 'root', group: 'horizon', mode: 0640 - ) + ) end it 'notifies web service to restart delayed' do @@ -132,13 +132,13 @@ describe 'openstack-dashboard::horizon' do it 'config ssl_cacert' do node.set['openstack']['dashboard']['ssl_cacert'] = '/path_to_cacert.pem' - expect(chef_run).to render_file(file.name).with_content(/^OPENSTACK_SSL_CACERT = '\/path_to_cacert.pem'$/) + expect(chef_run).to render_file(file.name).with_content(%r{^OPENSTACK_SSL_CACERT = '/path_to_cacert.pem'$}) end it 'does not config ssl_cacert when ssl disabled' do node.set['openstack']['dashboard']['use_ssl'] = false node.set['openstack']['dashboard']['ssl_cacert'] = '/path_to_cacert.pem' - expect(chef_run).not_to render_file(file.name).with_content(/^OPENSTACK_SSL_CACERT = '\/path_to_cacert.pem'$/) + expect(chef_run).not_to render_file(file.name).with_content(%r{^OPENSTACK_SSL_CACERT = '/path_to_cacert.pem'$}) end it 'has some allowed hosts set' do @@ -185,7 +185,7 @@ describe 'openstack-dashboard::horizon' do end it 'does override temp dir when it is not nil' do node.set['openstack']['dashboard']['file_upload_temp_dir'] = '/foobar' - expect(chef_run).to render_file(file.name).with_content(/^FILE_UPLOAD_TEMP_DIR = "\/foobar"$/) + expect(chef_run).to render_file(file.name).with_content(%r{^FILE_UPLOAD_TEMP_DIR = "/foobar"$}) end end end @@ -230,7 +230,7 @@ describe 'openstack-dashboard::horizon' do end it 'does have webroot set' do - expect(chef_run).to render_file(file.name).with_content(/^WEBROOT = \'\/\'$/) + expect(chef_run).to render_file(file.name).with_content(%r{^WEBROOT = '/'$}) end it 'does not have urls set' do @@ -426,8 +426,7 @@ describe 'openstack-dashboard::horizon' do { 'mysql' => 'django.db.backends.mysql', 'sqlite' => 'django.db.backends.sqlite3', - 'postgresql' => 'django.db.backends.postgresql_psycopg2', - 'db2' => 'ibm_db_django' }.each do |service_type, backend| + 'postgresql' => 'django.db.backends.postgresql_psycopg2' }.each do |service_type, backend| context "#{service_type} database settings" do before do allow_any_instance_of(Chef::Recipe).to receive(:db) @@ -499,14 +498,14 @@ describe 'openstack-dashboard::horizon' do expect(chef_run).not_to run_execute(sync_db_cmd).with( cwd: node['openstack']['dashboard']['django_path'], environment: sync_db_environment - ) + ) end it 'executes when session_backend is sql' do expect(chef_run_session_sql).to run_execute(sync_db_cmd).with( cwd: node['openstack']['dashboard']['django_path'], environment: sync_db_environment - ) + ) end it 'does not execute when the migrate attribute is set to false' do @@ -514,7 +513,7 @@ describe 'openstack-dashboard::horizon' do expect(chef_run_session_sql).not_to run_execute(sync_db_cmd).with( cwd: node['openstack']['dashboard']['django_path'], environment: sync_db_environment - ) + ) end it 'executes when database backend is sqlite' do @@ -522,7 +521,7 @@ describe 'openstack-dashboard::horizon' do expect(chef_run_session_sql).to run_execute(sync_db_cmd).with( cwd: node['openstack']['dashboard']['django_path'], environment: sync_db_environment - ) + ) end end diff --git a/templates/default/local_settings.py.erb b/templates/default/local_settings.py.erb index 9c94530..e48d9b3 100644 --- a/templates/default/local_settings.py.erb +++ b/templates/default/local_settings.py.erb @@ -559,8 +559,7 @@ FLAVOR_EXTRA_KEYS = { <% django_backends = {'mysql' => 'django.db.backends.mysql', 'sqlite' => 'django.db.backends.sqlite3', - 'postgresql' => 'django.db.backends.postgresql_psycopg2', - 'db2' => 'ibm_db_django'} + 'postgresql' => 'django.db.backends.postgresql_psycopg2'} engine = django_backends[@db_info['service_type']] %> # A dictionary containing the settings for all databases to be used with