From ce357cfef6dc56eb24637b03529264b962ad013a Mon Sep 17 00:00:00 2001 From: "Luis A. Garcia" Date: Fri, 7 Mar 2014 17:06:00 +0000 Subject: [PATCH] Add attribute for setting WSGISocketPrefix Change-Id: Ied5ef88393e353a35531ab2629aab0b272c92105 --- README.md | 1 + attributes/default.rb | 1 + spec/server_spec.rb | 9 +++++++++ templates/default/dash-site.erb | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 502ba32..940daac 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Attributes * `openstack["dashboard"]["ssl"]["key"]` - name to use when creating the ssl key * `openstack["dashboard"]["dash_path"]` - base path for dashboard files (document root) * `openstack["dashboard"]["wsgi_path"]` - path for wsgi dir +* `openstack["dashboard"]["wsgi_socket_prefix"]` - Location that will override the standard Apache runtime directory * `openstack["dashboard"]["ssl_offload"]` - Set SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') flag for offloading SSL * `openstack["dashboard"]["plugins"]` - Array of plugins to include via INSTALED\_APPS TODO: Add DB2 support on other platforms diff --git a/attributes/default.rb b/attributes/default.rb index 5e690eb..490cb9a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -117,6 +117,7 @@ default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard default['openstack']['dashboard']['static_path'] = "#{node['openstack']['dashboard']['django_path']}/static" default['openstack']['dashboard']['stylesheet_path'] = '/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html' default['openstack']['dashboard']['wsgi_path'] = node['openstack']['dashboard']['dash_path'] + '/wsgi/django.wsgi' +default['openstack']['dashboard']['wsgi_socket_prefix'] = nil default['openstack']['dashboard']['session_backend'] = 'memcached' default['openstack']['dashboard']['ssl_offload'] = false diff --git a/spec/server_spec.rb b/spec/server_spec.rb index 2885ead..72dd6f1 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -288,6 +288,15 @@ describe 'openstack-dashboard::server' do it 'sets the WSGI daemon user to attribute default' do expect(chef_run).to render_file(file.name).with_content('WSGIDaemonProcess dashboard user=horizon') end + + it 'sets wsgi socket prefix' do + node.set['openstack']['dashboard']['wsgi_socket_prefix'] = '/var/run/wsgi' + expect(chef_run).to render_file(file.name).with_content('WSGISocketPrefix /var/run/wsgi') + end + + it 'omits wsgi socket prefix' do + expect(chef_run).not_to render_file(file.name).with_content('WSGISocketPrefix') + end end describe 'secret_key_path file' do diff --git a/templates/default/dash-site.erb b/templates/default/dash-site.erb index 052f0a4..3c1c335 100644 --- a/templates/default/dash-site.erb +++ b/templates/default/dash-site.erb @@ -69,3 +69,7 @@ NameVirtualHost *:<%= node['openstack']['dashboard']['https_port'].to_i%> LogLevel warn CustomLog <%= node["apache"]["log_dir"] %>/<%= node["openstack"]["dashboard"]["access_log"] %> combined + +<% unless node["openstack"]["dashboard"]["wsgi_socket_prefix"].nil? %> +WSGISocketPrefix <%= node["openstack"]["dashboard"]["wsgi_socket_prefix"] %> +<% end %> \ No newline at end of file