3 describe 'keystone::wsgi::apache' do
8 :concat_basedir => '/var/lib/puppet/concat',
9 :fqdn => 'some.host.tld'
15 'class { keystone: admin_token => "dummy", service_name => "httpd", enable_ssl => true }'
19 shared_examples_for 'apache serving keystone with mod_wsgi' do
20 it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
21 it { is_expected.to contain_class('keystone::params') }
22 it { is_expected.to contain_class('apache') }
23 it { is_expected.to contain_class('apache::mod::wsgi') }
24 it { is_expected.to contain_class('keystone::db::sync') }
26 describe 'with default parameters' do
28 it { is_expected.to contain_file("#{platform_parameters[:wsgi_script_path]}").with(
29 'ensure' => 'directory',
30 'owner' => 'keystone',
31 'group' => 'keystone',
32 'require' => 'Package[httpd]'
35 it { is_expected.to contain_file('keystone_wsgi_admin').with(
37 'path' => "#{platform_parameters[:wsgi_script_path]}/admin",
38 'source' => platform_parameters[:wsgi_script_source],
39 'owner' => 'keystone',
40 'group' => 'keystone',
42 'require' => ["File[#{platform_parameters[:wsgi_script_path]}]", "Package[keystone]"]
45 it { is_expected.to contain_file('keystone_wsgi_main').with(
47 'path' => "#{platform_parameters[:wsgi_script_path]}/main",
48 'source' => platform_parameters[:wsgi_script_source],
49 'owner' => 'keystone',
50 'group' => 'keystone',
52 'require' => ["File[#{platform_parameters[:wsgi_script_path]}]", "Package[keystone]"]
55 it { is_expected.to contain_apache__vhost('keystone_wsgi_admin').with(
56 'servername' => 'some.host.tld',
59 'docroot' => "#{platform_parameters[:wsgi_script_path]}",
60 'docroot_owner' => 'keystone',
61 'docroot_group' => 'keystone',
63 'wsgi_daemon_process' => 'keystone_admin',
64 'wsgi_daemon_process_options' => {
66 'group' => 'keystone',
69 'display-name' => 'keystone-admin',
71 'wsgi_process_group' => 'keystone_admin',
72 'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/admin" },
73 'require' => 'File[keystone_wsgi_admin]'
76 it { is_expected.to contain_apache__vhost('keystone_wsgi_main').with(
77 'servername' => 'some.host.tld',
80 'docroot' => "#{platform_parameters[:wsgi_script_path]}",
81 'docroot_owner' => 'keystone',
82 'docroot_group' => 'keystone',
84 'wsgi_daemon_process' => 'keystone_main',
85 'wsgi_daemon_process_options' => {
87 'group' => 'keystone',
90 'display-name' => 'keystone-main',
92 'wsgi_process_group' => 'keystone_main',
93 'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/main" },
94 'require' => 'File[keystone_wsgi_main]'
96 it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
99 describe 'when overriding parameters using different ports' do
102 :servername => 'dummy.host',
103 :bind_host => '10.42.51.1',
104 :public_port => 12345,
111 it { is_expected.to contain_apache__vhost('keystone_wsgi_admin').with(
112 'servername' => 'dummy.host',
113 'ip' => '10.42.51.1',
115 'docroot' => "#{platform_parameters[:wsgi_script_path]}",
116 'docroot_owner' => 'keystone',
117 'docroot_group' => 'keystone',
119 'wsgi_daemon_process' => 'keystone_admin',
120 'wsgi_daemon_process_options' => {
121 'user' => 'keystone',
122 'group' => 'keystone',
125 'display-name' => 'keystone-admin',
127 'wsgi_process_group' => 'keystone_admin',
128 'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/admin" },
129 'require' => 'File[keystone_wsgi_admin]'
132 it { is_expected.to contain_apache__vhost('keystone_wsgi_main').with(
133 'servername' => 'dummy.host',
134 'ip' => '10.42.51.1',
136 'docroot' => "#{platform_parameters[:wsgi_script_path]}",
137 'docroot_owner' => 'keystone',
138 'docroot_group' => 'keystone',
140 'wsgi_daemon_process' => 'keystone_main',
141 'wsgi_daemon_process_options' => {
142 'user' => 'keystone',
143 'group' => 'keystone',
146 'display-name' => 'keystone-main',
148 'wsgi_process_group' => 'keystone_main',
149 'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/main" },
150 'require' => 'File[keystone_wsgi_main]'
153 it { is_expected.to contain_file("#{platform_parameters[:httpd_ports_file]}") }
156 describe 'when overriding parameters using same port' do
159 :servername => 'dummy.host',
160 :public_port => 4242,
162 :public_path => '/main/endpoint/',
163 :admin_path => '/admin/endpoint/',
169 it { is_expected.to_not contain_apache__vhost('keystone_wsgi_admin') }
171 it { is_expected.to contain_apache__vhost('keystone_wsgi_main').with(
172 'servername' => 'dummy.host',
175 'docroot' => "#{platform_parameters[:wsgi_script_path]}",
176 'docroot_owner' => 'keystone',
177 'docroot_group' => 'keystone',
179 'wsgi_daemon_process' => 'keystone_main',
180 'wsgi_daemon_process_options' => {
181 'user' => 'keystone',
182 'group' => 'keystone',
185 'display-name' => 'keystone-main',
187 'wsgi_process_group' => 'keystone_main',
188 'wsgi_script_aliases' => {
189 '/main/endpoint' => "#{platform_parameters[:wsgi_script_path]}/main",
190 '/admin/endpoint' => "#{platform_parameters[:wsgi_script_path]}/admin"
192 'require' => 'File[keystone_wsgi_main]'
196 describe 'when overriding parameters using same port and same path' do
199 :servername => 'dummy.host',
200 :public_port => 4242,
202 :public_path => '/endpoint/',
203 :admin_path => '/endpoint/',
209 it_raises 'a Puppet::Error', /When using the same port for public & private endpoints, public_path and admin_path should be different\./
212 describe 'when overriding parameters using symlink and custom file source' do
215 :wsgi_script_ensure => 'link',
216 :wsgi_script_source => '/opt/keystone/httpd/keystone.py',
220 it { is_expected.to contain_file('keystone_wsgi_admin').with(
222 'path' => "#{platform_parameters[:wsgi_script_path]}/admin",
223 'target' => '/opt/keystone/httpd/keystone.py',
224 'owner' => 'keystone',
225 'group' => 'keystone',
227 'require' => ["File[#{platform_parameters[:wsgi_script_path]}]", "Package[keystone]"]
230 it { is_expected.to contain_file('keystone_wsgi_main').with(
232 'path' => "#{platform_parameters[:wsgi_script_path]}/main",
233 'target' => '/opt/keystone/httpd/keystone.py',
234 'owner' => 'keystone',
235 'group' => 'keystone',
237 'require' => ["File[#{platform_parameters[:wsgi_script_path]}]", "Package[keystone]"]
242 context 'on RedHat platforms' do
245 :osfamily => 'RedHat',
246 :operatingsystemrelease => '6.0'
250 let :platform_parameters do
252 :httpd_service_name => 'httpd',
253 :httpd_ports_file => '/etc/httpd/conf/ports.conf',
254 :wsgi_script_path => '/var/www/cgi-bin/keystone',
255 :wsgi_script_source => '/usr/share/keystone/keystone.wsgi'
259 it_configures 'apache serving keystone with mod_wsgi'
262 context 'on Debian platforms' do
265 :osfamily => 'Debian',
266 :operatingsystem => 'Debian',
267 :operatingsystemrelease => '7.0'
271 let :platform_parameters do
273 :httpd_service_name => 'apache2',
274 :httpd_ports_file => '/etc/apache2/ports.conf',
275 :wsgi_script_path => '/usr/lib/cgi-bin/keystone',
276 :wsgi_script_source => '/usr/share/keystone/wsgi.py'
280 it_configures 'apache serving keystone with mod_wsgi'