diff --git a/attributes/default.rb b/attributes/default.rb index d8c8980..cda6a88 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -130,10 +130,10 @@ when 'debian' default['openstack']['dashboard']['logout_url'] = nil default['openstack']['dashboard']['login_redirect_url'] = nil default['openstack']['dashboard']['platform'] = { - 'memcache_python_packages' => ['python-memcache'], + 'memcache_python_packages' => ['python3-memcache'], 'package_overrides' => '', } - default['openstack']['dashboard']['platform']['horizon_packages'] = ['node-less', 'openstack-dashboard'] + default['openstack']['dashboard']['platform']['horizon_packages'] = ['node-less', 'libapache2-mod-wsgi-py3', 'python3-django-horizon', 'openstack-dashboard'] default['openstack']['dashboard']['apache']['sites-path'] = "#{node['apache']['dir']}/sites-available/openstack-dashboard.conf" else default['openstack']['dashboard']['key_group'] = 'root' @@ -220,5 +220,3 @@ default['openstack']['dashboard']['neutron']['enable_fwaas'] = false # 'varable2': 'value2', # } default['openstack']['dashboard']['misc_local_settings'] = nil -# version of python neutron-lbaas-dashboard package to install -default['openstack']['dashboard']['lbaas']['version'] = '3.0.1' diff --git a/recipes/apache2-server.rb b/recipes/apache2-server.rb index 9f80191..c7cb66b 100644 --- a/recipes/apache2-server.rb +++ b/recipes/apache2-server.rb @@ -62,7 +62,13 @@ node.normal['apache']['listen'] = apache2_listen.uniq include_recipe 'apache2' include_recipe 'apache2::mod_headers' -include_recipe 'apache2::mod_wsgi' +# TODO(jh): hardcoded to include py2 mod-wsgi package +# include_recipe 'apache2::mod_wsgi' +package 'libapache2-mod-wsgi-py3' do + only_if { platform_family?('debian') } +end +apache_module 'wsgi' + include_recipe 'apache2::mod_rewrite' include_recipe 'apache2::mod_ssl' if node['openstack']['dashboard']['use_ssl'] diff --git a/recipes/neutron-fwaas-dashboard.rb b/recipes/neutron-fwaas-dashboard.rb index 8b1b2cc..94d39d2 100644 --- a/recipes/neutron-fwaas-dashboard.rb +++ b/recipes/neutron-fwaas-dashboard.rb @@ -17,37 +17,4 @@ include_recipe 'openstack-dashboard::horizon' -django_path = node['openstack']['dashboard']['django_path'] -policy_file_path = node['openstack']['dashboard']['policy_files_path'] - -python_package 'neutron-fwaas-dashboard' - -%w( - _7010_project_firewalls_common.py - _7011_project_firewalls_panel.py - _7012_project_firewalls_v2_panel.py -).each do |file| - remote_file "#{django_path}/openstack_dashboard/local/enabled/#{file}" do - source "https://raw.githubusercontent.com/openstack/neutron-fwaas-dashboard/stable/queens/neutron_fwaas_dashboard/enabled/#{file}" - owner 'root' - mode 0o0644 - notifies :run, 'execute[neutron-fwaas-dashboard compilemessages]' - notifies :run, 'execute[openstack-dashboard collectstatic]' - end -end - -remote_file "#{policy_file_path}/neutron-fwaas-policy.json" do - source 'https://raw.githubusercontent.com/openstack/neutron-fwaas-dashboard/stable/queens/etc/neutron-fwaas-policy.json' - owner 'root' - mode 0o0644 - notifies :run, 'execute[neutron-fwaas-dashboard compilemessages]' - notifies :run, 'execute[openstack-dashboard collectstatic]' - notifies :restart, 'service[apache2]', :delayed -end - -execute 'neutron-fwaas-dashboard compilemessages' do - cwd django_path - environment 'PYTHONPATH' => "/etc/openstack-dashboard:#{django_path}:$PYTHONPATH" - command 'python manage.py compilemessages' - action :nothing -end +package 'python3-neutron-fwaas-dashboard' diff --git a/recipes/neutron-lbaas-dashboard.rb b/recipes/neutron-lbaas-dashboard.rb index bdb803d..00ff5b1 100644 --- a/recipes/neutron-lbaas-dashboard.rb +++ b/recipes/neutron-lbaas-dashboard.rb @@ -17,17 +17,4 @@ include_recipe 'openstack-dashboard::horizon' -django_path = node['openstack']['dashboard']['django_path'] - -python_package 'neutron-lbaas-dashboard' do - version node['openstack']['dashboard']['lbaas']['version'] - notifies :run, 'execute[restore-selinux-context]', :immediately - notifies :run, 'execute[openstack-dashboard collectstatic]' -end - -remote_file "#{django_path}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" do - source 'https://raw.githubusercontent.com/openstack/neutron-lbaas-dashboard/stable/queens/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py' - owner 'root' - mode 0o0644 - notifies :run, 'execute[openstack-dashboard collectstatic]' -end +package 'python3-neutron-lbaas-dashboard' diff --git a/spec/apache2-server_spec.rb b/spec/apache2-server_spec.rb index edb0a59..7ec8fa8 100644 --- a/spec/apache2-server_spec.rb +++ b/spec/apache2-server_spec.rb @@ -69,7 +69,6 @@ describe 'openstack-dashboard::apache2-server' do it 'includes apache packages' do %w(apache2 apache2::mod_headers - apache2::mod_wsgi apache2::mod_rewrite apache2::mod_ssl).each do |recipe| expect(chef_run).to include_recipe(recipe) diff --git a/spec/horizon_spec.rb b/spec/horizon_spec.rb index d875526..788d9a8 100644 --- a/spec/horizon_spec.rb +++ b/spec/horizon_spec.rb @@ -19,8 +19,10 @@ describe 'openstack-dashboard::horizon' do it 'installs packages' do expect(chef_run).to upgrade_package('node-less') + expect(chef_run).to upgrade_package('libapache2-mod-wsgi-py3') + expect(chef_run).to upgrade_package('python3-django-horizon') expect(chef_run).to upgrade_package('openstack-dashboard') - expect(chef_run).to upgrade_package('python-mysqldb') + expect(chef_run).to upgrade_package('python3-mysqldb') end describe 'local_settings.py' do diff --git a/spec/neutron-fwaas-dashboard_spec.rb b/spec/neutron-fwaas-dashboard_spec.rb index ff3ccf9..098c1c5 100644 --- a/spec/neutron-fwaas-dashboard_spec.rb +++ b/spec/neutron-fwaas-dashboard_spec.rb @@ -17,46 +17,7 @@ describe 'openstack-dashboard::neutron-fwaas-dashboard' do end it do - expect(chef_run).to install_python_package('neutron-fwaas-dashboard') - end - - %w( - _7010_project_firewalls_common.py - _7011_project_firewalls_panel.py - _7012_project_firewalls_v2_panel.py - ).each do |file| - it do - expect(chef_run).to create_remote_file( - "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard/local/enabled/#{file}" - ).with( - mode: 0o0644, - owner: 'root', - source: "https://raw.githubusercontent.com/openstack/neutron-fwaas-dashboard/stable/queens/neutron_fwaas_dashboard/enabled/#{file}" - ) - end - - it do - expect(chef_run.remote_file("#{node['openstack']['dashboard']['django_path']}/openstack_dashboard/local/enabled/#{file}")) - .to notify('execute[openstack-dashboard collectstatic]').to(:run) - notify('execute[neutron-fwaas-dashboard compilemessages]').to(:run) - end - end - - it do - expect(chef_run).to create_remote_file( - "#{node['openstack']['dashboard']['policy_files_path']}/neutron-fwaas-policy.json" - ).with( - mode: 0o0644, - owner: 'root', - source: 'https://raw.githubusercontent.com/openstack/neutron-fwaas-dashboard/stable/queens/etc/neutron-fwaas-policy.json' - ) - end - - it do - expect(chef_run.remote_file("#{node['openstack']['dashboard']['policy_files_path']}/neutron-fwaas-policy.json")) - .to notify('execute[openstack-dashboard collectstatic]').to(:run) - notify('execute[neutron-fwaas-dashboard compilemessages]').to(:run) - notify('service[apache2]').to(:restart).delayed + expect(chef_run).to install_package('python3-neutron-fwaas-dashboard') end end end diff --git a/spec/neutron-lbaas-dashboard_spec.rb b/spec/neutron-lbaas-dashboard_spec.rb index 37ac8db..61cf143 100644 --- a/spec/neutron-lbaas-dashboard_spec.rb +++ b/spec/neutron-lbaas-dashboard_spec.rb @@ -17,22 +17,7 @@ describe 'openstack-dashboard::neutron-lbaas-dashboard' do end it do - expect(chef_run).to install_python_package('neutron-lbaas-dashboard') - end - - it do - expect(chef_run).to create_remote_file( - "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" - ).with( - mode: 0o0644, - owner: 'root', - source: 'https://raw.githubusercontent.com/openstack/neutron-lbaas-dashboard/stable/queens/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py' - ) - end - - it do - expect(chef_run.remote_file("#{node['openstack']['dashboard']['django_path']}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py")) - .to notify('execute[openstack-dashboard collectstatic]') + expect(chef_run).to install_package('python3-neutron-lbaas-dashboard') end end end