Merge lp:~vladimir.p/nova/lp833106 into lp:~hudson-openstack/nova/trunk

Proposed by Vladimir Popovski
Status: Merged
Approved by: Ed Leafe
Approved revision: 1486
Merged at revision: 1498
Proposed branch: lp:~vladimir.p/nova/lp833106
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 23 lines (+5/-1)
1 file modified
nova/log.py (+5/-1)
To merge this branch: bzr merge lp:~vladimir.p/nova/lp833106
Reviewer Review Type Date Requested Status
Ed Leafe (community) Approve
Ben McGraw (community) Approve
Jesse Andrews (community) Approve
Mandell (community) community Approve
Review via email: mp+72767@code.launchpad.net

Description of the change

check log file's mode prior to calling chmod

To post a comment you must log in.
Revision history for this message
Mandell (mdegerne) wrote :

lgtm

review: Approve (community)
Revision history for this message
Ed Leafe (ed-leafe) wrote :

The 'import stat' statement belongs at the top of the file.

review: Needs Fixing
Revision history for this message
Vladimir Popovski (vladimir.p) wrote :

done

lp:~vladimir.p/nova/lp833106 updated
1485. By Vladimir Popovski

moved import to the top

Revision history for this message
Ed Leafe (ed-leafe) wrote :

Close, but no cigar. :)

The 'import' statements should be alphabetically arranged, so it needs to be between the 'os' and 'sys' import statements.

review: Needs Fixing
lp:~vladimir.p/nova/lp833106 updated
1486. By Vladimir Popovski

moved import up

Revision history for this message
Jesse Andrews (anotherjesse) wrote :

lgtm

review: Approve
Revision history for this message
Ben McGraw (mcgrue) wrote :

lgtm

review: Approve
Revision history for this message
Ed Leafe (ed-leafe) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/log.py'
2--- nova/log.py 2011-07-29 16:28:02 +0000
3+++ nova/log.py 2011-08-25 16:00:54 +0000
4@@ -32,6 +32,7 @@
5 import logging
6 import logging.handlers
7 import os
8+import stat
9 import sys
10 import traceback
11
12@@ -257,7 +258,10 @@
13 self.filelog = WatchedFileHandler(logpath)
14 self.addHandler(self.filelog)
15 self.logpath = logpath
16- os.chmod(self.logpath, FLAGS.logfile_mode)
17+
18+ st = os.stat(self.logpath)
19+ if st.st_mode != (stat.S_IFREG | FLAGS.logfile_mode):
20+ os.chmod(self.logpath, FLAGS.logfile_mode)
21 else:
22 self.removeHandler(self.filelog)
23 self.addHandler(self.streamlog)