Skip to content

Commit

Permalink
Ensure non-default FLAGS.logfile_mode is properly converted to an octet.
Browse files Browse the repository at this point in the history
Fixes bug 862969.

Change-Id: I35ac84d5f5f547fef8e3eec1d3a31f94ea8ae96e
  • Loading branch information
Adam Gandelman committed Sep 30, 2011
1 parent eb4bd86 commit 5b173ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nova/flags.py
Expand Up @@ -351,7 +351,7 @@ def _get_my_ip():
'Directory for lock files')
DEFINE_string('logdir', None, 'output to a per-service log file in named '
'directory')
DEFINE_integer('logfile_mode', 0644, 'Default file mode of the logs.')
DEFINE_string('logfile_mode', '0644', 'Default file mode of the logs.')
DEFINE_string('sqlite_db', 'nova.sqlite', 'file name for sqlite')
DEFINE_string('sql_connection',
'sqlite:///$state_path/$sqlite_db',
Expand Down
5 changes: 3 additions & 2 deletions nova/log.py
Expand Up @@ -259,9 +259,10 @@ def setup_from_flags(self):
self.addHandler(self.filelog)
self.logpath = logpath

mode = int(FLAGS.logfile_mode, 8)
st = os.stat(self.logpath)
if st.st_mode != (stat.S_IFREG | FLAGS.logfile_mode):
os.chmod(self.logpath, FLAGS.logfile_mode)
if st.st_mode != (stat.S_IFREG | mode):
os.chmod(self.logpath, mode)
else:
self.removeHandler(self.filelog)
self.addHandler(self.streamlog)
Expand Down

0 comments on commit 5b173ef

Please sign in to comment.