Skip to content

Commit da01dd7

Browse files
committed
Fix middleware order of proxy pipeline and add missing modules
This patch fixes the order of the middlewares defined in the Swift proxy server pipeline. Sources for the order: https://github.com/openstack/swift/blob/master/etc/proxy-server.conf-sample#L91-L99 http://docs.openstack.org/developer/swift/middleware.html# https://github.com/openstack/swift3/blob/master/etc/proxy-server.conf-sample#L9 https://github.com/openstack/ceilometermiddleware/blob/master/ceilometermiddleware/swift.py#L21-L22 These are all values in order: 10 catch_errors 20 gatekeeper 30 healthcheck 40 (reserved for proxy_logging, see below) 50 cache 60 container_sync 70 swift3 80 s3token 90 ratelimit 100 crossdomain 110 bulk 120 tempurl 130 formpost 140 copy 150 tempauth 160 swauth 170 authtoken 180 keystone 190 staticweb 200 copy 210 account_quotas 220 container_quotas 230 slo 240 dlo 250 versioned_writes 260 ceilometer 270 proxy-logging 280 proxy-server The copy and versioned_writes middlewares have been added too. The proxy_logging should be added a second time at position 40, but the actual value is 270 to have the final proxy-logging just before the proxy-server. Also renamed the suffix 'swauth' in the 'tempauth' manifest to be 'tempauth'; 'swauth' is used in a different manifest. Closes-Bug: 1618514 Change-Id: I99433720e32dc3557b809c8d42ce3d5981c199c3
1 parent 3eb1b82 commit da01dd7

31 files changed

+167
-37
lines changed

manifests/proxy/account_quotas.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
concat::fragment { 'swift_account_quotas':
2525
target => '/etc/swift/proxy-server.conf',
2626
content => template('swift/proxy/account_quotas.conf.erb'),
27-
order => '80',
27+
order => '210',
2828
}
2929
}

manifests/proxy/authtoken.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
concat::fragment { 'swift_authtoken':
147147
target => '/etc/swift/proxy-server.conf',
148148
content => template('swift/proxy/authtoken.conf.erb'),
149-
order => '22',
149+
order => '170',
150150
}
151151

152152
}

manifests/proxy/bulk.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@
4949
concat::fragment { 'swift_bulk':
5050
target => '/etc/swift/proxy-server.conf',
5151
content => template('swift/proxy/bulk.conf.erb'),
52-
order => '21',
52+
order => '110',
5353
}
5454
}

manifests/proxy/cache.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
concat::fragment { 'swift_cache':
3333
target => '/etc/swift/proxy-server.conf',
3434
content => template('swift/proxy/cache.conf.erb'),
35-
order => '23',
35+
order => '50',
3636
}
3737

3838
}

manifests/proxy/catch_errors.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
concat::fragment { 'swift_catch_errors':
2323
target => '/etc/swift/proxy-server.conf',
2424
content => template('swift/proxy/catch_errors.conf.erb'),
25-
order => '24',
25+
order => '10',
2626
}
2727

2828
}

manifests/proxy/ceilometer.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
concat::fragment { 'swift_ceilometer':
103103
target => '/etc/swift/proxy-server.conf',
104104
content => template('swift/proxy/ceilometer.conf.erb'),
105-
order => '33',
105+
order => '260',
106106
require => Class['::ceilometer'],
107107
}
108108

manifests/proxy/container_quotas.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
concat::fragment { 'swift_container_quotas':
2525
target => '/etc/swift/proxy-server.conf',
2626
content => template('swift/proxy/container_quotas.conf.erb'),
27-
order => '81',
27+
order => '220',
2828
}
2929
}

manifests/proxy/container_sync.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
concat::fragment { 'swift_container_sync':
1010
target => '/etc/swift/proxy-server.conf',
1111
content => template('swift/proxy/container_sync.conf.erb'),
12-
order => '82',
12+
order => '60',
1313
}
1414
}

manifests/proxy/copy.pp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Configure swift copy.
3+
#
4+
# == Examples
5+
#
6+
# include ::swift::proxy::copy
7+
#
8+
# == Parameters
9+
#
10+
# [*object_post_as_copy*]
11+
# Set object_post_as_copy = false to turn on fast posts where only the metadata
12+
# changes are stored anew and the original data file is kept in place. This
13+
# makes for quicker posts.
14+
# When object_post_as_copy is set to true, a POST request will be transformed
15+
# into a COPY request where source and destination objects are the same. This
16+
# is the current default in Swift.
17+
#
18+
class swift::proxy::copy (
19+
$object_post_as_copy = true
20+
) {
21+
22+
include ::swift::deps
23+
24+
concat::fragment { 'swift_copy':
25+
target => '/etc/swift/proxy-server.conf',
26+
content => template('swift/proxy/copy.conf.erb'),
27+
order => '140',
28+
}
29+
30+
}

manifests/proxy/crossdomain.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
concat::fragment { 'swift_crossdomain':
2121
target => '/etc/swift/proxy-server.conf',
2222
content => template('swift/proxy/crossdomain.conf.erb'),
23-
order => '35',
23+
order => '100',
2424
}
2525

2626
}

manifests/proxy/dlo.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
concat::fragment { 'swift_dlo':
4040
target => '/etc/swift/proxy-server.conf',
4141
content => template('swift/proxy/dlo.conf.erb'),
42-
order => '36',
42+
order => '240',
4343
}
4444

4545
}

manifests/proxy/formpost.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
concat::fragment { 'swift-proxy-formpost':
2323
target => '/etc/swift/proxy-server.conf',
2424
content => template('swift/proxy/formpost.conf.erb'),
25-
order => '31',
25+
order => '130',
2626
}
2727

2828
}

manifests/proxy/gatekeeper.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
concat::fragment { 'swift_gatekeeper':
4949
target => '/etc/swift/proxy-server.conf',
5050
content => template('swift/proxy/gatekeeper.conf.erb'),
51-
order => '34',
51+
order => '20',
5252
}
5353

5454
}

manifests/proxy/healthcheck.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
concat::fragment { 'swift_healthcheck':
2121
target => '/etc/swift/proxy-server.conf',
2222
content => template('swift/proxy/healthcheck.conf.erb'),
23-
order => '25',
23+
order => '30',
2424
}
2525

2626
}

manifests/proxy/keystone.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
concat::fragment { 'swift_keystone':
4040
target => '/etc/swift/proxy-server.conf',
4141
content => template('swift/proxy/keystone.conf.erb'),
42-
order => '79',
42+
order => '180',
4343
}
4444

4545
}

manifests/proxy/proxy_logging.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
concat::fragment { 'swift_proxy-logging':
1313
target => '/etc/swift/proxy-server.conf',
1414
content => template('swift/proxy/proxy-logging.conf.erb'),
15-
order => '27',
15+
order => '270',
1616
}
1717
}

manifests/proxy/ratelimit.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
concat::fragment { 'swift_ratelimit':
5454
target => '/etc/swift/proxy-server.conf',
5555
content => template('swift/proxy/ratelimit.conf.erb'),
56-
order => '26',
56+
order => '90',
5757
}
5858

5959
}

manifests/proxy/s3token.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939
concat::fragment { 'swift_s3token':
4040
target => '/etc/swift/proxy-server.conf',
4141
content => template('swift/proxy/s3token.conf.erb'),
42-
order => '28',
42+
order => '80',
4343
}
4444
}

manifests/proxy/slo.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
concat::fragment { 'swift_slo':
5555
target => '/etc/swift/proxy-server.conf',
5656
content => template('swift/proxy/slo.conf.erb'),
57-
order => '35',
57+
order => '230',
5858
}
5959

6060
}

manifests/proxy/staticweb.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
concat::fragment { 'swift-proxy-staticweb':
2424
target => '/etc/swift/proxy-server.conf',
2525
content => template('swift/proxy/staticweb.conf.erb'),
26-
order => '32',
26+
order => '190',
2727
}
2828

2929
}

manifests/proxy/swauth.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
concat::fragment { 'swift_proxy_swauth':
3333
target => '/etc/swift/proxy-server.conf',
3434
content => template('swift/proxy/swauth.conf.erb'),
35-
order => '20',
35+
order => '160',
3636
}
3737

3838
}

manifests/proxy/swift3.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
concat::fragment { 'swift_swift3':
3737
target => '/etc/swift/proxy-server.conf',
3838
content => template('swift/proxy/swift3.conf.erb'),
39-
order => '27',
39+
order => '70',
4040
}
4141

4242
}

manifests/proxy/tempauth.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ # == class: swift::proxy::tempauth
105105
validate_re($storage_url_scheme, ['http','https','default'])
106106
}
107107

108-
concat::fragment { 'swift-proxy-swauth':
108+
concat::fragment { 'swift-proxy-tempauth':
109109
target => '/etc/swift/proxy-server.conf',
110110
content => template('swift/proxy/tempauth.conf.erb'),
111-
order => '01',
111+
order => '150',
112112
}
113113

114114
}

manifests/proxy/tempurl.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
concat::fragment { 'swift-proxy-tempurl':
9898
target => '/etc/swift/proxy-server.conf',
9999
content => template('swift/proxy/tempurl.conf.erb'),
100-
order => '29',
100+
order => '120',
101101
}
102102

103103
}

manifests/proxy/versioned_writes.pp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Configure Swift versioned_writes.
3+
#
4+
# == Examples
5+
#
6+
# include ::swift::proxy::versioned_writes
7+
#
8+
# == Parameters
9+
#
10+
# [*allow_versioned_writes*]
11+
# Enables using versioned writes middleware and exposing configuration
12+
# settings via HTTP GET /info.
13+
#
14+
class swift::proxy::versioned_writes (
15+
$allow_versioned_writes = false
16+
) {
17+
18+
include ::swift::deps
19+
20+
concat::fragment { 'swift_versioned_writes':
21+
target => '/etc/swift/proxy-server.conf',
22+
content => template('swift/proxy/versioned_writes.conf.erb'),
23+
order => '250',
24+
}
25+
26+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- Fix the middleware order in the proxy server pipeline according to
4+
upstream documentation
5+
features:
6+
- Add missing copy and versioned_writes middlewares

spec/classes/swift_proxy_copy_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe 'swift::proxy::copy' do
4+
5+
let :facts do
6+
{}
7+
end
8+
9+
describe "when using default parameters" do
10+
it 'should build the fragment with correct parameters' do
11+
is_expected.to contain_concat_fragment('swift_copy').with_content('
12+
[filter:copy]
13+
use = egg:swift#copy
14+
object_post_as_copy = true
15+
')
16+
end
17+
end
18+
19+
describe "when overriding default parameters" do
20+
let :params do
21+
{
22+
:object_post_as_copy => false,
23+
}
24+
end
25+
it 'should build the fragment with correct parameters' do
26+
is_expected.to contain_concat_fragment('swift_copy').with_content(/object_post_as_copy = false/)
27+
end
28+
end
29+
30+
end

spec/classes/swift_proxy_tempauth_spec.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
'concat { "/etc/swift/proxy-server.conf": }'
2020
end
2121

22-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/\[filter:tempauth\]\nuse = egg:swift#tempauth/) }
22+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/\[filter:tempauth\]\nuse = egg:swift#tempauth/) }
23+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/user_admin_admin = admin \.admin \.reseller_admin/) }
2324

24-
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/reseller_prefix/) }
25-
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/token_life/) }
26-
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/auth_prefix/) }
27-
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/storage_url_scheme/) }
28-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/user_admin_admin = admin \.admin \.reseller_admin/) }
25+
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/reseller_prefix/) }
26+
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/token_life/) }
27+
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/auth_prefix/) }
28+
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/storage_url_scheme/) }
2929

3030
context 'declaring two users' do
3131
let :params do {
@@ -44,10 +44,10 @@
4444
},
4545
]
4646
} end
47-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(
47+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(
4848
/user_admin_admin = admin \.admin \.reseller_admin/
4949
) }
50-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(
50+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(
5151
/user_bar_foo = pass \.reseller_admin/
5252
) }
5353
end
@@ -63,7 +63,7 @@
6363
},
6464
]
6565
} end
66-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/user_admin_admin = admin $/) }
66+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/user_admin_admin = admin $/) }
6767
end
6868

6969

@@ -76,10 +76,10 @@
7676
}.merge(default_params)
7777
end
7878

79-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/reseller_prefix = AUTH/) }
80-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/token_life = 81600/) }
81-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/auth_prefix = \/auth\//) }
82-
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/storage_url_scheme = http/) }
79+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/reseller_prefix = AUTH/) }
80+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/token_life = 81600/) }
81+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/auth_prefix = \/auth\//) }
82+
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/storage_url_scheme = http/) }
8383

8484
describe "invalid params" do
8585
['account_user_list', 'token_life', 'auth_prefix', 'storage_url_scheme'].each do |param|
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe 'swift::proxy::versioned_writes' do
4+
5+
let :facts do
6+
{}
7+
end
8+
9+
describe "when using default parameters" do
10+
it 'should build the fragment with correct parameters' do
11+
is_expected.to contain_concat_fragment('swift_versioned_writes').with_content('
12+
[filter:versioned_writes]
13+
use = egg:swift#versioned_writes
14+
allow_versioned_writes = false
15+
')
16+
end
17+
end
18+
19+
describe "when overriding default parameters" do
20+
let :params do
21+
{
22+
:allow_versioned_writes => true,
23+
}
24+
end
25+
it 'should build the fragment with correct parameters' do
26+
is_expected.to contain_concat_fragment('swift_versioned_writes').with_content(/allow_versioned_writes = true/)
27+
end
28+
end
29+
30+
end

templates/proxy/copy.conf.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
[filter:copy]
3+
use = egg:swift#copy
4+
object_post_as_copy = <%= @object_post_as_copy %>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
[filter:versioned_writes]
3+
use = egg:swift#versioned_writes
4+
allow_versioned_writes = <%= @allow_versioned_writes %>

0 commit comments

Comments
 (0)