Merge "Use python3 packages on Ubuntu"

This commit is contained in:
Zuul 2019-11-25 15:52:50 +00:00 committed by Gerrit Code Review
commit e58df346ee
8 changed files with 64 additions and 99 deletions

View File

@ -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'
@ -221,4 +221,4 @@ default['openstack']['dashboard']['neutron']['enable_fwaas'] = false
# }
default['openstack']['dashboard']['misc_local_settings'] = nil
# version of python neutron-lbaas-dashboard package to install
default['openstack']['dashboard']['lbaas']['version'] = '3.0.1'
default['openstack']['dashboard']['lbaas']['version'] = '5.0.0'

View File

@ -62,7 +62,15 @@ node.normal['apache']['listen'] = apache2_listen.uniq
include_recipe 'apache2'
include_recipe 'apache2::mod_headers'
include_recipe 'apache2::mod_wsgi'
# TODO(jh): recipe is hardcoded to include py2 mod-wsgi package
case node['platform_family']
when 'debian'
package 'libapache2-mod-wsgi-py3'
apache_module 'wsgi'
when 'rhel'
include_recipe 'apache2::mod_wsgi'
end
include_recipe 'apache2::mod_rewrite'
include_recipe 'apache2::mod_ssl' if node['openstack']['dashboard']['use_ssl']

View File

@ -17,37 +17,42 @@
include_recipe 'openstack-dashboard::horizon'
django_path = node['openstack']['dashboard']['django_path']
policy_file_path = node['openstack']['dashboard']['policy_files_path']
case node['platform_family']
when 'debian'
package 'python3-neutron-fwaas-dashboard'
when 'rhel'
django_path = node['openstack']['dashboard']['django_path']
policy_file_path = node['openstack']['dashboard']['policy_files_path']
python_package 'neutron-fwaas-dashboard'
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}"
%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://opendev.org/openstack/neutron-fwaas-dashboard/raw/branch/stable/rocky/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://opendev.org/openstack/neutron-fwaas-dashboard/raw/branch/stable/rocky/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
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

View File

@ -17,17 +17,22 @@
include_recipe 'openstack-dashboard::horizon'
django_path = node['openstack']['dashboard']['django_path']
case node['platform_family']
when 'debian'
package 'python3-neutron-lbaas-dashboard'
when 'rhel'
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
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]'
remote_file "#{django_path}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py" do
source 'https://opendev.org/openstack/neutron-lbaas-dashboard/raw/branch/stable/rocky/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py'
owner 'root'
mode 0o0644
notifies :run, 'execute[openstack-dashboard collectstatic]'
end
end

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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