Merge lp:~cmiller/desktopcouch/lp530322 into lp:desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Chad Miller
Approved revision: 269
Merged at revision: 271
Proposed branch: lp:~cmiller/desktopcouch/lp530322
Merge into: lp:desktopcouch
Diff against target: 20 lines (+6/-2)
1 file modified
desktopcouch/application/local_files.py (+6/-2)
To merge this branch: bzr merge lp:~cmiller/desktopcouch/lp530322
Reviewer Review Type Date Requested Status
dobey (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+56363@code.launchpad.net

Commit message

Don't LBYL in mkdir or chown of desktopcouch directories. (LP: #530322)

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

+1

review: Approve
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/application/local_files.py'
2--- desktopcouch/application/local_files.py 2010-11-26 23:11:50 +0000
3+++ desktopcouch/application/local_files.py 2011-04-05 13:52:17 +0000
4@@ -183,10 +183,14 @@
5 self.couchdb_log_level = 'notice'
6
7 for d in (run_dir, db_dir, config_dir):
8- if not os.path.isdir(d):
9+ try:
10 os.makedirs(d, 0700)
11- else:
12+ except OSError, ex:
13+ pass # Probably that it already exists.
14+ try:
15 os.chmod(d, 0700)
16+ except OSError:
17+ logging.warn("Failed to chmod %s", d)
18
19 self.run_dir = os.path.realpath(run_dir)
20 self.config_dir = os.path.realpath(config_dir)

Subscribers

People subscribed via source and target branches