From aa67698a7dd553e9ff5a2d157f37d42f75a7a7b1 Mon Sep 17 00:00:00 2001 From: Adam Gandelman Date: Thu, 29 Sep 2011 21:06:06 -0700 Subject: [PATCH] Ensure non-default FLAGS.logfile_mode is properly converted to an octet. Fixes bug 862969. Change-Id: I35ac84d5f5f547fef8e3eec1d3a31f94ea8ae96e --- nova/flags.py | 2 +- nova/log.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nova/flags.py b/nova/flags.py index 1050f0347..f3a6239b5 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -351,7 +351,7 @@ DEFINE_string('lock_path', os.path.join(os.path.dirname(__file__), '../'), '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', diff --git a/nova/log.py b/nova/log.py index eb0b6020f..1e04f755d 100644 --- a/nova/log.py +++ b/nova/log.py @@ -259,9 +259,10 @@ class NovaRootLogger(NovaLogger): 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)