summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-12-07 06:44:13 +0000
committerMark McLoughlin <markmc@redhat.com>2012-12-07 06:44:13 +0000
commit479f19c1bc27e7ef7d4f1bf6037570403bd4d71b (patch)
treea886bd5f380cef3864cce0bd70ca42dac9224335
parent27b2ff42ce6bf13c394cf5516b220e8abc87a968 (diff)
downloadoslo-479f19c1bc27e7ef7d4f1bf6037570403bd4d71b.tar.gz
oslo-479f19c1bc27e7ef7d4f1bf6037570403bd4d71b.tar.xz
oslo-479f19c1bc27e7ef7d4f1bf6037570403bd4d71b.zip
Add deprecated --logdir common opt
--logfile and --logdir are aliases Nova has for the --log-file and --log-dir. If we're to support --logfile as a deprecated common option, we should do the same for --logdir. Change-Id: I16485a93070d9ad7789a287d5b035c6f270ffead
-rw-r--r--openstack/common/cfg.py1
-rw-r--r--tests/unit/test_cfg.py13
2 files changed, 12 insertions, 2 deletions
diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py
index f5b3a84..4e93205 100644
--- a/openstack/common/cfg.py
+++ b/openstack/common/cfg.py
@@ -1760,6 +1760,7 @@ class CommonConfigOpts(ConfigOpts):
help='(Optional) Name of log file to output to. '
'If not set, logging will go to stdout.'),
StrOpt('log-dir',
+ deprecated_name='logdir',
help='(Optional) The directory to keep log files in '
'(will be prepended to --log-file)'),
BoolOpt('use-syslog',
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py
index 0279c6a..5a22f76 100644
--- a/tests/unit/test_cfg.py
+++ b/tests/unit/test_cfg.py
@@ -1613,12 +1613,21 @@ class CommonOptsTestCase(BaseTestCase):
self.conf(['--log-file', log_file])
self.assertEquals(self.conf.log_file, log_file)
- def test_logfile(self):
+ def test_logfile_deprecated(self):
logfile = '/some/other/path/foo-bar.log'
- #NOTE(dprince): this is now a deprecated option for --log-file
self.conf(['--logfile', logfile])
self.assertEquals(self.conf.log_file, logfile)
+ def test_log_dir(self):
+ log_dir = '/some/path/'
+ self.conf(['--log-dir', log_dir])
+ self.assertEquals(self.conf.log_dir, log_dir)
+
+ def test_logdir_deprecated(self):
+ logdir = '/some/other/path/'
+ self.conf(['--logdir', logdir])
+ self.assertEquals(self.conf.log_dir, logdir)
+
class ConfigParserTestCase(unittest.TestCase):
def test_no_section(self):