Merge lp:~gholt/swift/late_loadapp into lp:~hudson-openstack/swift/trunk

Proposed by gholt on 2011-04-12
Status: Merged
Approved by: David Goetz on 2011-04-15
Approved revision: 265
Merged at revision: 271
Proposed branch: lp:~gholt/swift/late_loadapp
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 23 lines (+4/-2)
1 file modified
swift/common/wsgi.py (+4/-2)
To merge this branch: bzr merge lp:~gholt/swift/late_loadapp
Reviewer Review Type Date Requested Status
Swift Core security contacts 2011-04-12 Pending
Review via email: mp+57261@code.launchpad.net

Description of the change

Move loadapp to after-fork

To post a comment you must log in.
gholt (gholt) wrote :

Don't approve until after Cactus.

lp:~gholt/swift/late_loadapp updated on 2011-04-12
265. By gholt on 2011-04-12

Put early loadapp back in, even though we won't use the result, to test for any instantiation problems early

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swift/common/wsgi.py'
2--- swift/common/wsgi.py 2011-02-14 23:02:08 +0000
3+++ swift/common/wsgi.py 2011-04-12 18:31:34 +0000
4@@ -124,8 +124,8 @@
5 # remaining tasks should not require elevated privileges
6 drop_privileges(conf.get('user', 'swift'))
7
8- # finally after binding to ports and privilege drop, run app __init__ code
9- app = loadapp('config:%s' % conf_file, global_conf={'log_name': log_name})
10+ # Ensure the application can be loaded before proceeding.
11+ loadapp('config:%s' % conf_file, global_conf={'log_name': log_name})
12
13 # redirect errors to logger and close stdio
14 capture_stdio(logger)
15@@ -135,6 +135,8 @@
16 eventlet.hubs.use_hub('poll')
17 eventlet.patcher.monkey_patch(all=False, socket=True)
18 monkey_patch_mimetools()
19+ app = loadapp('config:%s' % conf_file,
20+ global_conf={'log_name': log_name})
21 pool = GreenPool(size=1024)
22 try:
23 wsgi.server(sock, app, NullLogger(), custom_pool=pool)